Skip to content

Commit 17ed608

Browse files
committed
Rename options to --build and --exec
1 parent cdc77a0 commit 17ed608

File tree

4 files changed

+1254
-64
lines changed

4 files changed

+1254
-64
lines changed
107 KB
Binary file not shown.

lnt/tests/test_suite.py

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,19 @@ def __init__(self):
186186

187187
def run_test(self, opts):
188188

189-
# Validate new build/test mode options
190-
if opts.build_only and opts.test_prebuilt:
191-
self._fatal("--build-only and --test-prebuilt are mutually exclusive")
189+
# Validate build/exec mode options
190+
if opts.build and opts.exec_mode:
191+
self._fatal("--build and --exec are mutually exclusive")
192192

193-
if opts.test_prebuilt and opts.build_dir is None and not opts.exec_interleaved_builds:
194-
self._fatal("--test-prebuilt requires --build-dir (or use --exec-interleaved-builds)")
193+
if opts.exec_mode and opts.build_dir is None and not opts.exec_interleaved_builds:
194+
self._fatal("--exec requires --build-dir (or use --exec-interleaved-builds)")
195+
196+
if opts.build_dir and not opts.exec_mode and not opts.exec_interleaved_builds:
197+
self._fatal("--build-dir can only be used with --exec or --exec-interleaved-builds")
195198

196199
if opts.exec_interleaved_builds:
197-
# --exec-interleaved-builds implies --test-prebuilt
198-
opts.test_prebuilt = True
200+
# --exec-interleaved-builds implies --exec
201+
opts.exec_mode = True
199202
# Parse and validate build directories
200203
opts.exec_interleaved_builds_list = [
201204
os.path.abspath(d.strip())
@@ -213,17 +216,13 @@ def run_test(self, opts):
213216
build_dir)
214217

215218
if opts.build_dir:
216-
# Validate and normalize build directory path
219+
# Validate build directory
217220
opts.build_dir = os.path.abspath(opts.build_dir)
218-
if opts.test_prebuilt:
219-
# In test-prebuilt mode, build directory must already exist
220-
if not os.path.exists(opts.build_dir):
221-
self._fatal("--build-dir does not exist: %r" % opts.build_dir)
222-
cmakecache = os.path.join(opts.build_dir, 'CMakeCache.txt')
223-
if not os.path.exists(cmakecache):
224-
self._fatal("--build-dir is not a configured build: %r" % opts.build_dir)
225-
# In normal build mode, --build-dir specifies where to create the build
226-
# (directory will be created if it doesn't exist)
221+
if not os.path.exists(opts.build_dir):
222+
self._fatal("--build-dir does not exist: %r" % opts.build_dir)
223+
cmakecache = os.path.join(opts.build_dir, 'CMakeCache.txt')
224+
if not os.path.exists(cmakecache):
225+
self._fatal("--build-dir is not a configured build: %r" % opts.build_dir)
227226

228227
if opts.cc is not None:
229228
opts.cc = resolve_command_path(opts.cc)
@@ -249,10 +248,10 @@ def run_test(self, opts):
249248
else:
250249
# If --cc not specified, CMake will use its default compiler discovery
251250
# We'll validate that a compiler was found after configuration
252-
if opts.cc is None and not opts.test_prebuilt:
251+
if opts.cc is None and not opts.exec_mode:
253252
logger.info("No --cc specified, will use CMake's default compiler discovery")
254253

255-
if not opts.test_prebuilt:
254+
if not opts.exec_mode:
256255
# These are only required when building
257256
if opts.test_suite_root is None:
258257
self._fatal('--test-suite is required')
@@ -287,8 +286,8 @@ def run_test(self, opts):
287286
opts.only_test = opts.single_result
288287

289288
if opts.only_test:
290-
if not opts.test_prebuilt:
291-
# Only validate against test_suite_root if we're not in test-prebuilt mode
289+
if not opts.exec_mode:
290+
# Only validate against test_suite_root if we're not in exec mode
292291
# --only-test can either point to a particular test or a directory.
293292
# Therefore, test_suite_root + opts.only_test or
294293
# test_suite_root + dirname(opts.only_test) must be a directory.
@@ -303,7 +302,7 @@ def run_test(self, opts):
303302
else:
304303
self._fatal("--only-test argument not understood (must be a " +
305304
" test or directory name)")
306-
# else: in test-prebuilt mode, we'll use only_test as-is for filtering
305+
# else: in exec mode, we'll use only_test as-is for filtering
307306

308307
if opts.single_result and not opts.only_test[1]:
309308
self._fatal("--single-result must be given a single test name, "
@@ -320,15 +319,15 @@ def run_test(self, opts):
320319
self.start_time = timestamp()
321320

322321
# Work out where to put our build stuff
323-
if opts.build_dir:
324-
# If --build-dir is specified, use it (for any build type)
322+
if opts.exec_mode and opts.build_dir:
323+
# In exec mode with --build-dir, use the specified build directory
325324
basedir = opts.build_dir
326325
elif opts.exec_interleaved_builds:
327326
# For exec-interleaved-builds, each build uses its own directory
328327
# We'll return early from _run_interleaved_builds(), so basedir doesn't matter
329328
basedir = opts.sandbox_path
330329
else:
331-
# Normal mode: use sandbox/build or sandbox/test-<timestamp>
330+
# Normal mode or build mode: use sandbox/build or sandbox/test-<timestamp>
332331
if opts.timestamp_build:
333332
ts = self.start_time.replace(' ', '_').replace(':', '-')
334333
build_dir_name = "test-%s" % ts
@@ -339,12 +338,12 @@ def run_test(self, opts):
339338
self._base_path = basedir
340339

341340
cmakecache = os.path.join(self._base_path, 'CMakeCache.txt')
342-
if opts.test_prebuilt:
343-
# In test-prebuilt mode, the build is already configured and compiled
341+
if opts.exec_mode:
342+
# In exec mode, the build is already configured and compiled
344343
self.configured = True
345344
self.compiled = True
346345
else:
347-
# In normal/build-only mode, check if we should skip reconfiguration
346+
# In normal/build mode, check if we should skip reconfiguration
348347
self.configured = not opts.run_configure and \
349348
os.path.exists(cmakecache)
350349

@@ -359,8 +358,8 @@ def run_test(self, opts):
359358
if opts.exec_interleaved_builds:
360359
return self._run_interleaved_builds(opts)
361360

362-
# Configure if needed (skip in test-prebuilt mode)
363-
if not opts.test_prebuilt:
361+
# Configure if needed (skip in exec mode)
362+
if not opts.exec_mode:
364363
# configure, so we can extract toolchain information from the cmake
365364
# output.
366365
self._configure_if_needed()
@@ -397,19 +396,19 @@ def run_test(self, opts):
397396
fatal("Cannot detect compiler version. Specify --run-order"
398397
" to manually define it.")
399398

400-
# Handle --build-only mode
401-
if opts.build_only:
402-
logger.info("Building tests (--build-only mode)...")
399+
# Handle --build mode
400+
if opts.build:
401+
logger.info("Building tests (--build mode)...")
403402
self.run(cmake_vars, compile=True, test=False, skip_lit=True)
404403
logger.info("Build complete. Build directory: %s" % self._base_path)
405-
logger.info("Use --test-prebuilt --build-dir %s to run tests." % self._base_path)
404+
logger.info("Use --exec --build-dir %s to run tests." % self._base_path)
406405
return lnt.util.ImportData.no_submit()
407406

408407
# Now do the actual run.
409408
reports = []
410409
json_reports = []
411-
# In test-prebuilt mode, we only run tests, no compilation
412-
if opts.test_prebuilt:
410+
# In exec mode, we only run tests, no compilation
411+
if opts.exec_mode:
413412
for i in range(opts.exec_multisample):
414413
# only gather perf profiles on a single run.
415414
p = i == 0 and opts.use_perf in ('profile', 'all')
@@ -1354,26 +1353,25 @@ def diagnose(self):
13541353
is_flag=True, default=False,)
13551354
@click.option("--remote-host", metavar="HOST",
13561355
help="Run tests on a remote machine")
1357-
@click.option("--build-only", "build_only",
1358-
help="Only build the tests, don't run them. Useful for "
1356+
@click.option("--build", "build",
1357+
help="Only build the tests, don't execute them. Useful for "
13591358
"preparing builds for later interleaved execution.",
13601359
is_flag=True, default=False)
1361-
@click.option("--test-prebuilt", "test_prebuilt",
1362-
help="Only run tests from pre-built directory, skip configure "
1363-
"and build steps. Use with --build-dir to specify the "
1364-
"build directory.",
1360+
@click.option("--exec", "exec_mode",
1361+
help="Only execute tests from pre-built directory, skip configure "
1362+
"and build steps. Requires --build-dir to specify the "
1363+
"build directory. Default behavior is to both build and execute.",
13651364
is_flag=True, default=False)
13661365
@click.option("--build-dir", "build_dir",
13671366
metavar="PATH",
1368-
help="Specify build directory location. With --test-prebuilt, this must "
1369-
"be an existing configured build. With --build-only or normal mode, "
1370-
"specifies where to create the build (overrides default sandbox/build "
1371-
"or timestamped directory). Path can be absolute or relative to sandbox.",
1367+
help="Path to pre-built test directory (used with --exec). "
1368+
"This is the actual build directory (e.g., sandbox/build), "
1369+
"not the sandbox parent directory.",
13721370
type=click.UNPROCESSED, default=None)
13731371
@click.option("--exec-interleaved-builds", "exec_interleaved_builds",
13741372
metavar="BUILD1,BUILD2,...",
13751373
help="Comma-separated list of build directories to interleave "
1376-
"execution from. Implies --test-prebuilt. Each path should be "
1374+
"execution from. Implies --exec. Each path should be "
13771375
"a build directory (e.g., sandbox/build). For each multisample, "
13781376
"runs all tests from each build in sequence to control for "
13791377
"environmental changes.",

tests/runtest/test_suite-interleaved-builds.shtest

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Check interleaved builds feature (--build-only, --test-prebuilt, --exec-interleaved-builds)
1+
# Check interleaved builds feature (--build, --exec, --exec-interleaved-builds)
22

3-
# Test 1: Build-only mode
3+
# Test 1: Build mode
44
# RUN: rm -rf %t.SANDBOX-A %t.SANDBOX-B %t.SANDBOX-RESULTS
55
# RUN: lnt runtest test-suite \
66
# RUN: --sandbox %t.SANDBOX-A \
@@ -10,12 +10,12 @@
1010
# RUN: --use-cmake %S/Inputs/test-suite-cmake/fake-cmake \
1111
# RUN: --use-make %S/Inputs/test-suite-cmake/fake-make \
1212
# RUN: --use-lit %S/Inputs/test-suite-cmake/fake-lit \
13-
# RUN: --build-only \
13+
# RUN: --build \
1414
# RUN: > %t.build-a.log 2> %t.build-a.err
15-
# RUN: filecheck --check-prefix CHECK-BUILD-ONLY < %t.build-a.err %s
16-
# CHECK-BUILD-ONLY: Building tests (--build-only mode)...
17-
# CHECK-BUILD-ONLY: Build complete. Build directory: {{.*}}SANDBOX-A/build
18-
# CHECK-BUILD-ONLY: Use --test-prebuilt --build-dir {{.*}}SANDBOX-A/build to run tests.
15+
# RUN: filecheck --check-prefix CHECK-BUILD < %t.build-a.err %s
16+
# CHECK-BUILD: Building tests (--build mode)...
17+
# CHECK-BUILD: Build complete. Build directory: {{.*}}SANDBOX-A/build
18+
# CHECK-BUILD: Use --exec --build-dir {{.*}}SANDBOX-A/build to run tests.
1919

2020
# Test 2: Build a second sandbox
2121
# RUN: lnt runtest test-suite \
@@ -26,14 +26,14 @@
2626
# RUN: --use-cmake %S/Inputs/test-suite-cmake/fake-cmake \
2727
# RUN: --use-make %S/Inputs/test-suite-cmake/fake-make \
2828
# RUN: --use-lit %S/Inputs/test-suite-cmake/fake-lit \
29-
# RUN: --build-only \
29+
# RUN: --build \
3030
# RUN: > %t.build-b.log 2> %t.build-b.err
3131

32-
# Test 3: Test prebuilt with single build
32+
# Test 3: Exec prebuilt with single build
3333
# RUN: lnt runtest test-suite \
3434
# RUN: --sandbox %t.SANDBOX-RESULTS \
3535
# RUN: --no-timestamp \
36-
# RUN: --test-prebuilt \
36+
# RUN: --exec \
3737
# RUN: --build-dir %t.SANDBOX-A/build \
3838
# RUN: --use-cmake %S/Inputs/test-suite-cmake/fake-cmake \
3939
# RUN: --use-lit %S/Inputs/test-suite-cmake/fake-lit \
@@ -88,24 +88,24 @@
8888
# RUN: test -f %t.SANDBOX-B/build/test-results.xunit.xml
8989
# RUN: test -f %t.SANDBOX-B/build/test-results.csv
9090

91-
# Test 6: Error case - --build-only with --test-prebuilt should fail
91+
# Test 6: Error case - --build with --exec should fail
9292
# RUN: not lnt runtest test-suite \
9393
# RUN: --sandbox %t.SANDBOX-ERR \
9494
# RUN: --no-timestamp \
9595
# RUN: --test-suite %S/Inputs/test-suite-cmake \
9696
# RUN: --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
97-
# RUN: --build-only \
98-
# RUN: --test-prebuilt \
97+
# RUN: --build \
98+
# RUN: --exec \
9999
# RUN: > %t.err1.log 2> %t.err1.err
100100
# RUN: filecheck --check-prefix CHECK-ERR1 < %t.err1.err %s
101-
# CHECK-ERR1: --build-only and --test-prebuilt are mutually exclusive
101+
# CHECK-ERR1: --build and --exec are mutually exclusive
102102

103-
# Test 7: Error case - --test-prebuilt without --build-dir or --exec-interleaved-builds should fail
103+
# Test 7: Error case - --exec without --build-dir or --exec-interleaved-builds should fail
104104
# RUN: not lnt runtest test-suite \
105105
# RUN: --sandbox %t.SANDBOX-ERR2 \
106106
# RUN: --no-timestamp \
107-
# RUN: --test-prebuilt \
107+
# RUN: --exec \
108108
# RUN: --use-lit %S/Inputs/test-suite-cmake/fake-lit \
109109
# RUN: > %t.err2.log 2> %t.err2.err
110110
# RUN: filecheck --check-prefix CHECK-ERR2 < %t.err2.err %s
111-
# CHECK-ERR2: --test-prebuilt requires --build-dir (or use --exec-interleaved-builds)
111+
# CHECK-ERR2: --exec requires --build-dir (or use --exec-interleaved-builds)

0 commit comments

Comments
 (0)