Skip to content

Commit 96222e6

Browse files
author
bneradt
committed
Supporting out of source builds for AuTests.
This adds the --build-root autest option to support running AuTest for out of source builds where the built binaries reside in a directory tree outside of where the Traffic Server AuTests themselves are located.
1 parent b527464 commit 96222e6

6 files changed

Lines changed: 31 additions & 8 deletions

File tree

tests/gold_tests/autest-site/init.cli.ext

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ if AuTestVersion() < autest_version:
3131
Settings.path_argument(["--ats-bin"],
3232
required=True,
3333
help="A user provided directory to ATS bin")
34+
35+
Settings.path_argument(["--build-root"],
36+
required=False,
37+
help="The location of the build root for out of source builds")

tests/gold_tests/autest-site/setup.cli.ext

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,22 @@
1717
# limitations under the License.
1818

1919
import json
20-
import subprocess
20+
import os
2121
import pprint
22+
import subprocess
2223

2324
if Arguments.ats_bin is not None:
2425
# Add environment variables
2526
ENV['ATS_BIN'] = Arguments.ats_bin
2627

28+
if Arguments.build_root is not None:
29+
ENV['BUILD_ROOT'] = Arguments.build_root
30+
else:
31+
# Assume the build root is the parent of the test directory.
32+
ENV['BUILD_ROOT'] = os.path.dirname(os.getcwd())
33+
34+
host.WriteVerbose(['ats'], "Test build root: {}:".format(ENV['BUILD_ROOT']))
35+
2736
if ENV['ATS_BIN'] is not None:
2837
# Add variables for Tests
2938
traffic_layout = os.path.join(ENV['ATS_BIN'], "traffic_layout")
@@ -78,9 +87,12 @@ if ENV['ATS_BIN'] is not None:
7887
host.WriteError("tsxs is broken. Aborting tests", show_stack=False)
7988
host.WriteVerbose(['ats'], "Traffic server build flags:\n", pprint.pformat(out))
8089
Variables.update(out)
81-
Variables.AtsExampleDir = os.path.join(AutestSitePath, '../../../example')
82-
Variables.AtsTestToolsDir = os.path.join(AutestSitePath, '../../tools')
83-
Variables.AtsTestPluginsDir = os.path.join(AutestSitePath, '../../tools/plugins/.libs')
90+
91+
Variables.AtsExampleDir = os.path.join(AutestSitePath, '..', '..', '..', 'example')
92+
Variables.AtsTestToolsDir = os.path.join(AutestSitePath, '..', '..', 'tools')
93+
Variables.BuildRoot = ENV['BUILD_ROOT']
94+
Variables.AtsTestPluginsDir = os.path.join(Variables.BuildRoot, 'tests', 'tools', 'plugins', '.libs')
95+
Variables.AtsBuildGoldTestsDir = os.path.join(Variables.BuildRoot, 'tests', 'gold_tests')
8496

8597
# modify delay times as we always have to kill Trafficserver
8698
# no need to wait

tests/gold_tests/chunked_encoding/chunked_encoding.test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19+
import os
20+
1921
Test.Summary = '''
2022
Test chunked encoding processing
2123
'''
@@ -94,7 +96,7 @@
9496

9597
# smuggle-client is built via `make`. Here we copy the built binary down to the
9698
# test directory so that the test runs in this file can use it.
97-
Test.Setup.Copy('smuggle-client')
99+
Test.Setup.Copy(os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'chunked_encoding', 'smuggle-client'))
98100

99101
# HTTP1.1 GET: www.example.com
100102
tr = Test.AddTestRun()

tests/gold_tests/continuations/session_id.test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
ts.addSSLfile("ssl/server.pem")
4040
ts.addSSLfile("ssl/server.key")
4141

42-
Test.PrepareTestPlugin(os.path.join(Test.TestDirectory, 'plugins', '.libs', 'session_id_verify.so'), ts)
42+
Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsBuildGoldTestsDir,
43+
'continuations', 'plugins', '.libs', 'session_id_verify.so'), ts)
4344

4445
ts.Disk.records_config.update({
4546
'proxy.config.diags.debug.enabled': 1,

tests/gold_tests/timeout/tls_conn_timeout.test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19+
import os
20+
1921
Test.Summary = 'Testing ATS TLS handshake timeout'
2022

2123
ts = Test.MakeATSProcess("ts")
2224

23-
Test.Setup.Copy('ssl-delay-server')
25+
Test.Setup.Copy(os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'timeout', 'ssl-delay-server'))
2426

2527
Test.ContinueOnFail = True
2628
Test.GetTcpPort("block_connect_port")

tests/gold_tests/tls/tls.test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19+
import os
20+
1921
Test.Summary = '''
2022
Test tls
2123
'''
@@ -26,7 +28,7 @@
2628

2729
# ssl-post is built via `make`. Here we copy the built binary down to the test
2830
# directory so that the test runs in this file can use it.
29-
Test.Setup.Copy('ssl-post')
31+
Test.Setup.Copy(os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'tls', 'ssl-post'))
3032

3133
requestLocation = "test2"
3234
reHost = "www.example.com"

0 commit comments

Comments
 (0)