Skip to content

Commit

Permalink
tests adjusted to --build-modes
Browse files Browse the repository at this point in the history
  • Loading branch information
avarga committed Oct 11, 2024
1 parent ba27af9 commit aa26ca3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions tests/project_tester
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parser = argparse.ArgumentParser(description="Run tests for a project.")
parser.add_argument("--workspace", help="Path to the workspace to use for the test. Default is a temporary directory.")
parser.add_argument("--dry-run", default=False, action='store_true', help="Do not actually run the test program")
parser.add_argument("--really", default=False, action='store_true', help="Do not be deterred if the number of test cases is too high")
parser.add_argument("--build-mode", action='append', metavar='debug,release,...', help="Build mode(s)")
parser.add_argument("--build-modes", action='append', metavar='debug,release,...', help="Build mode(s)")
parser.add_argument("--precmd", help="Command to run before each test case. Not affected by --dry-run.")
parser.add_argument("--postcmd", help="Command to run after each test case. Not affected by --dry-run.")
parser.add_argument("-f", "--testcase-file", help="File that contains one test case (one or more project filters) per line. These test cases will be done in addition to the ones specified on the command line.")
Expand All @@ -29,7 +29,7 @@ command = args.command
project_filters = args.project_filters
dry_run = args.dry_run
really = args.really
build_mode = ",".join(args.build_mode) if args.build_mode else ""
build_modes = ",".join(args.build_modes) if args.build_modes else ""
workspace = args.workspace
smoke_test = True

Expand Down Expand Up @@ -82,8 +82,8 @@ for project_list in test_cases:
projects_string = " ".join(project_list)

options = "-n"
if build_mode:
options += f" --build-mode {build_mode}"
if build_modes:
options += f" --build-modes {build_modes}"
if "cannot be installed in the standard way" in subprocess.check_output(f"opp_env info {projects_string}", shell=True, text=True):
options += " --options=source-archive"
if smoke_test:
Expand Down
8 changes: 4 additions & 4 deletions tests/smoketest_install_and_run
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,23 @@ assert_contains_line 'make MODE=release invoked'
assert_contains_line 'make test invoked'

#
# check --build-mode (should set $BUILD_MODES)
# check --build-modes (should set $BUILD_MODES)
#

rm -rf $WORKSPACE/opp_env_testproject-*
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-mode=debug
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-modes=debug
assert_contains_line 'BUILD_MODES=debug'
assert_contains_line 'make MODE=debug invoked'
assert_not_contains 'make MODE=release invoked'

rm -rf $WORKSPACE/opp_env_testproject-*
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-mode=release
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-modes=release
assert_contains_line 'BUILD_MODES=release'
assert_contains_line 'make MODE=release invoked'
assert_not_contains 'make MODE=debug invoked'

rm -rf $WORKSPACE/opp_env_testproject-*
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-mode=foo,bar
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-modes=foo,bar
assert_contains_line 'BUILD_MODES=foo bar'
assert_contains_line 'make MODE=foo invoked'
assert_contains_line 'make MODE=bar invoked'
Expand Down
8 changes: 4 additions & 4 deletions tests/smoketest_nixless
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,23 @@ assert_contains_line 'make MODE=release invoked'
assert_contains_line 'make test invoked'

#
# check --build-mode (should set $BUILD_MODES)
# check --build-modes (should set $BUILD_MODES)
#

rm -rf $WORKSPACE/opp_env_testproject-*
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-mode=debug
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-modes=debug
assert_contains_line 'BUILD_MODES=debug'
assert_contains_line 'make MODE=debug invoked'
assert_not_contains 'make MODE=release invoked'

rm -rf $WORKSPACE/opp_env_testproject-*
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-mode=release
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-modes=release
assert_contains_line 'BUILD_MODES=release'
assert_contains_line 'make MODE=release invoked'
assert_not_contains 'make MODE=debug invoked'

rm -rf $WORKSPACE/opp_env_testproject-*
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-mode=foo,bar
run opp_env install -w $WORKSPACE opp_env_testproject-latest --build-modes=foo,bar
assert_contains_line 'BUILD_MODES=foo bar'
assert_contains_line 'make MODE=foo invoked'
assert_contains_line 'make MODE=bar invoked'
Expand Down

0 comments on commit aa26ca3

Please # to comment.