Skip to content

Commit

Permalink
PR #12247 from Eran: add unit-test-config --not-live and make use in GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel authored Oct 3, 2023
2 parents 6e56dbf + 31e7973 commit 3b52e44
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/buildsCI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions unit-tests/unit-test-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3b52e44

Please sign in to comment.