From 31e7973bb1f17650b84aa8bf971f123ab96bb299 Mon Sep 17 00:00:00 2001 From: Eran Date: Mon, 2 Oct 2023 09:04:25 +0300 Subject: [PATCH] add unit-test-config --not-live and make use in GHA --- .github/workflows/buildsCI.yaml | 4 ++-- unit-tests/unit-test-config.py | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/buildsCI.yaml b/.github/workflows/buildsCI.yaml index 564d6e3796..4baffcfa14 100644 --- a/.github/workflows/buildsCI.yaml +++ b/.github/workflows/buildsCI.yaml @@ -139,7 +139,7 @@ jobs: run: | LRS_SRC_DIR=$(pwd) cd ${{env.WIN_BUILD_DIR}} - cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=false -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DBUILD_UNIT_TESTS=true -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=false -DPYTHON_EXECUTABLE=${{env.PYTHON_PATH}} -DBUILD_PYTHON_BINDINGS=true + cmake ${LRS_SRC_DIR} -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=false -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DBUILD_UNIT_TESTS=true -DUNIT_TESTS_ARGS="--not-live --context=windows" -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=false -DPYTHON_EXECUTABLE=${{env.PYTHON_PATH}} -DBUILD_PYTHON_BINDINGS=true - name: Build # Build your program with the given configuration @@ -340,7 +340,7 @@ jobs: shell: bash run: | cd build - cmake .. -DCMAKE_BUILD_TYPE=${{env.LRS_RUN_CONFIG}} -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DBUILD_UNIT_TESTS=true -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=false -DBUILD_PYTHON_BINDINGS=true -DPYTHON_EXECUTABLE=$(which python3) + cmake .. -DCMAKE_BUILD_TYPE=${{env.LRS_RUN_CONFIG}} -DBUILD_SHARED_LIBS=true -DBUILD_EXAMPLES=false -DBUILD_TOOLS=true -DBUILD_UNIT_TESTS=true -DUNIT_TESTS_ARGS="--not-live --context=linux" -DCHECK_FOR_UPDATES=false -DBUILD_WITH_DDS=false -DBUILD_PYTHON_BINDINGS=true -DPYTHON_EXECUTABLE=$(which python3) cmake --build . -- -j4 - name: LibCI diff --git a/unit-tests/unit-test-config.py b/unit-tests/unit-test-config.py index 7883d0f39b..4c3b00839a 100644 --- a/unit-tests/unit-test-config.py +++ b/unit-tests/unit-test-config.py @@ -37,6 +37,7 @@ def usage(): print( ' with what tags it has' ) print( ' --context The context to use for test configuration' ) print( ' --live Only configure tests that are live (have test:device)' ) + print( ' --not-live Only configure tests that are NOT live (do not have test:device)' ) sys.exit(2) regex = None @@ -45,10 +46,11 @@ def usage(): list_tests = False context = None live_only = False +not_live_only = False # parse command-line: try: opts, args = getopt.getopt( sys.argv[1:], 'hr:t:', - longopts=['help', 'regex=', 'tag=', 'list-tags', 'list-tests', 'context=', 'live'] ) + longopts=['help', 'regex=', 'tag=', 'list-tags', 'list-tests', 'context=', 'live', 'not-live'] ) except getopt.GetoptError as err: log.e( err ) # something like "option -a not recognized" usage() @@ -66,7 +68,13 @@ def usage(): elif opt == '--context': context = arg elif opt == '--live': + if not_live_only: + raise RuntimeError( '--live and --not-live are mutually exclusive' ) live_only = True + elif opt == '--not-live': + if live_only: + raise RuntimeError( '--live and --not-live are mutually exclusive' ) + not_live_only = True if len( args ) != 2: usage() @@ -194,7 +202,7 @@ def find_includes( filepath, filelist, dependencies ): return filelist def process_cpp( dir, builddir ): - global regex, required_tags, list_only, available_tags, tests_and_tags, live_only + global regex, required_tags, list_only, available_tags, tests_and_tags, live_only, not_live_only found = [] shareds = [] statics = [] @@ -231,6 +239,9 @@ def process_cpp( dir, builddir ): if live_only: if not config.configurations: continue + elif not_live_only: + if config.configurations: + continue # Build the list of files we want in the project: # At a minimum, we have the original file, plus any common files