This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 1d9201b Move the test-only plugins test_hooks and test_cppapi to tests/tools/plugins . 1d9201b is described below commit 1d9201b0f00d8eaae98d5471d99325ac55317798 Author: Walter Karas <wka...@oath.com> AuthorDate: Mon Oct 22 14:05:04 2018 -0500 Move the test-only plugins test_hooks and test_cppapi to tests/tools/plugins . Also changes trafficserver extension to Au Test: - Adds 'extra_build_args' parameter to Test.PreparePlugin() method, a string containing extra parameters to the tsxs command building the plugin. - Adds a -L parameter to the tsxs that specifies the directory in the installed TS layout containing TS libraries. --- plugins/Makefile.am | 2 -- plugins/for_testing_only/test_cppapi/Makefile.inc | 19 ------------------- plugins/for_testing_only/test_hooks/Makefile.inc | 19 ------------------- .../autest-site/trafficserver_plugins.test.ext | 14 ++++++++++++-- tests/gold_tests/pluginTest/cppapi/cppapi.test.py | 2 +- .../pluginTest/test_hooks/test_hooks.test.py | 4 ++-- .../tools/plugins}/test_cppapi.cc | 0 .../test_hooks => tests/tools/plugins}/test_hooks.cc | 0 8 files changed, 15 insertions(+), 45 deletions(-) diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 5a05bd9..e1d0dad 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -34,8 +34,6 @@ include cache_promote/Makefile.inc include conf_remap/Makefile.inc include escalate/Makefile.inc include esi/Makefile.inc -include for_testing_only/test_cppapi/Makefile.inc -include for_testing_only/test_hooks/Makefile.inc include generator/Makefile.inc include compress/Makefile.inc include header_rewrite/Makefile.inc diff --git a/plugins/for_testing_only/test_cppapi/Makefile.inc b/plugins/for_testing_only/test_cppapi/Makefile.inc deleted file mode 100644 index c673090..0000000 --- a/plugins/for_testing_only/test_cppapi/Makefile.inc +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -pkglib_LTLIBRARIES += for_testing_only/test_cppapi/test_cppapi.la -for_testing_only_test_cppapi_test_cppapi_la_LIBADD = $(top_builddir)/src/tscpp/api/libtscppapi.la -for_testing_only_test_cppapi_test_cppapi_la_SOURCES = for_testing_only/test_cppapi/test_cppapi.cc diff --git a/plugins/for_testing_only/test_hooks/Makefile.inc b/plugins/for_testing_only/test_hooks/Makefile.inc deleted file mode 100644 index 91838aa..0000000 --- a/plugins/for_testing_only/test_hooks/Makefile.inc +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -pkglib_LTLIBRARIES += for_testing_only/test_hooks/test_hooks.la -for_testing_only_test_hooks_test_hooks_la_LIBADD = $(top_builddir)/src/tscpp/api/libtscppapi.la -for_testing_only_test_hooks_test_hooks_la_SOURCES = for_testing_only/test_hooks/test_hooks.cc diff --git a/tests/gold_tests/autest-site/trafficserver_plugins.test.ext b/tests/gold_tests/autest-site/trafficserver_plugins.test.ext index c34fbff..e6e3087 100644 --- a/tests/gold_tests/autest-site/trafficserver_plugins.test.ext +++ b/tests/gold_tests/autest-site/trafficserver_plugins.test.ext @@ -19,7 +19,7 @@ Builds, installs, and enables an ATS plugin in the sandbox environment import os -def prepare_plugin(self, path, tsproc, plugin_args = ""): +def prepare_plugin(self, path, tsproc, plugin_args = "", extra_build_args=''): """Builds, installs, and enables an ATS plugin in the sandbox environment The source file at the given path is copied to the sandbox directory of the @@ -39,12 +39,22 @@ def prepare_plugin(self, path, tsproc, plugin_args = ""): Condition.HasProgram(tsxs, "tsxs needs be installed with trafficserver package for this test to run") ) + link_gxx="export CC=c++ &&" # Compile the plugin. in_basename = os.path.basename(path) + if in_basename.endswith(".c"): + link_gxx = '' in_path = os.path.join(plugin_dir, in_basename) out_basename = os.path.splitext(in_basename)[0] + '.so' out_path = os.path.join(plugin_dir, out_basename) - tsproc.Setup.RunCommand("{tsxs} -c {0} -o {1}".format(in_path, out_path, tsxs=tsxs)) + tsproc.Setup.RunCommand( + "{pre_args} {tsxs} {args} -c {0} -o {1}".format( + in_path, + out_path, + tsxs=tsxs, + args=" -L {0} {1}".format(self.Variables.LIBDIR, extra_build_args), + pre_args=link_gxx) + ) # Add an entry to plugin.config. tsproc.Disk.plugin_config.AddLine("{0} {1}".format(out_basename,plugin_args)) diff --git a/tests/gold_tests/pluginTest/cppapi/cppapi.test.py b/tests/gold_tests/pluginTest/cppapi/cppapi.test.py index 1f4f0c3..809eb2a 100644 --- a/tests/gold_tests/pluginTest/cppapi/cppapi.test.py +++ b/tests/gold_tests/pluginTest/cppapi/cppapi.test.py @@ -20,7 +20,7 @@ Execute plugin with cppapi tests. ts = Test.MakeATSProcess("ts") -ts.Disk.plugin_config.AddLine('test_cppapi.so') +Test.PreparePlugin(Test.Variables.AtsTestToolsDir + '/plugins/test_cppapi.cc', ts, extra_build_args='-l tscppapi') tr = Test.AddTestRun() tr.Processes.Default.StartBefore(Test.Processes.ts) diff --git a/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py b/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py index d513afb..6f79dae 100644 --- a/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py +++ b/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py @@ -37,12 +37,12 @@ ts.Disk.records_config.update({ # 'proxy.config.diags.debug.tags': 'http|test_hooks' }) -ts.Disk.plugin_config.AddLine('test_hooks.so') - ts.Disk.remap_config.AddLine( "map http://one http://127.0.0.1:{0}".format(server.Variables.Port) ) +Test.PreparePlugin(Test.Variables.AtsTestToolsDir + '/plugins/test_hooks.cc', ts) + tr = Test.AddTestRun() tr.Processes.Default.StartBefore(Test.Processes.ts) tr.Processes.Default.StartBefore(Test.Processes.server) diff --git a/plugins/for_testing_only/test_cppapi/test_cppapi.cc b/tests/tools/plugins/test_cppapi.cc similarity index 100% rename from plugins/for_testing_only/test_cppapi/test_cppapi.cc rename to tests/tools/plugins/test_cppapi.cc diff --git a/plugins/for_testing_only/test_hooks/test_hooks.cc b/tests/tools/plugins/test_hooks.cc similarity index 100% rename from plugins/for_testing_only/test_hooks/test_hooks.cc rename to tests/tools/plugins/test_hooks.cc