@@ -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." ,
0 commit comments