diff --git a/Makefile b/Makefile index 4f1689e20631552883b9c39660947c53d1b1e5ef..4e60f0f8f6eeceb84fce0ce53a1cc670a5f928b3 100644 --- a/Makefile +++ b/Makefile @@ -30,5 +30,9 @@ tests: $(TEST_FILES) | $(BUILD_MARKER) mkdir -p bin/tests javac -d bin/tests -cp $(BUILD_DEST):$(LIBS):lib/junit-4.13.jar $^ +# basic config sanity check +check-config: refit + java -cp $(BUILD_DEST):$(LIBS) refit.config.REFITConfigTest + clean: -rm -rf bin || true diff --git a/experiments/helper.sh b/experiments/helper.sh index 16cb7b0e64ac7575308de3a821f9d63c684d0c69..b70f050712d39a7fc6a53c5b6858172c99e3f6c4 100644 --- a/experiments/helper.sh +++ b/experiments/helper.sh @@ -6,9 +6,14 @@ HOME="$(cd `dirname $0` && pwd)" EXPERIMENT_NAME="$(basename "$HOME")" MAIN_DIR="$(cd ~/../.. && pwd)" err_code=1 +check="" config_files=( "scripts/config/java" "scripts/config/refit-overrides" ) +if [[ "$1" == "--check" ]]; then + check="--check" +fi + function cleanup() { # only try to restore a bckp file if it actually exists for i in "${config_files[@]}"; do @@ -40,7 +45,7 @@ done # queue experiment cd "$MAIN_DIR/scripts" -exp/exp remote -m "$SCRIPT" "$EXPERIMENT_NAME" "$EXPERIMENT_DURATION" +exp/exp remote $check -m "$SCRIPT" "$EXPERIMENT_NAME" "$EXPERIMENT_DURATION" # cleanup err_code=0 diff --git a/scripts/exp/exp-experiment b/scripts/exp/exp-experiment index 97392ac440641778444735325e8ccfa010f9047e..cb35c09a32e84e8026a41b670c4bf0aae4f30461 100755 --- a/scripts/exp/exp-experiment +++ b/scripts/exp/exp-experiment @@ -5,6 +5,13 @@ SCRIPT_DIR="${BASE_DIR}/experiments" ERRORS=0 +check="" +if [[ "$1" == "--check" ]]; then + echo "Checking experiment configurations" + check="--check" + shift +fi + for cmd in "$@"; do if [[ "$cmd" == "" || ! -x "${SCRIPT_DIR}/$cmd/run.sh" ]]; then echo "Invalid experiment name $cmd" @@ -20,7 +27,7 @@ if [[ "$ERRORS" == 0 ]]; then for cmd in "$@"; do if [[ "$cmd" != "" || -x "${SCRIPT_DIR}/$cmd/run.sh" ]]; then pushd "${SCRIPT_DIR}/$cmd" > /dev/null - if ! ./run.sh ; then + if ! ./run.sh $check ; then echo "!!! Execution failed !!!" exit 1 fi @@ -28,6 +35,7 @@ if [[ "$ERRORS" == 0 ]]; then fi done else + echo "Usage: exp experiment [--check] experiment_name [experiment_name...]" echo "Available experiments:" cd "$SCRIPT_DIR" for i in *; do diff --git a/scripts/test/benchmark.py b/scripts/test/benchmark.py index bcbf5ba885faf650c7b2d1721e05bf06f7ecd52c..fb24e2b0e2160397cda6c64a24756e22c27b7936 100755 --- a/scripts/test/benchmark.py +++ b/scripts/test/benchmark.py @@ -489,6 +489,8 @@ def execute(cls, cmd_args): queue_parser.add_argument("-p", "--prio", help="Use priority queue", action="store_true") queue_parser.add_argument("-m", "--multi", help="Generate variants", action="store_true") queue_parser.add_argument("-n", "--dry-run", help="Prepare only benchmark execution", action="store_true") + queue_parser.add_argument("-c", "--check", help="Run configuration check for every experiment variant. " + "Implies dry-run", action="store_true") queue_parser.add_argument("--parent-folder", help="Enqueue the whole repository parent folder", action="store_true") queue_parser.add_argument("testfile", help="test script which controls the benchmark execution") @@ -568,6 +570,8 @@ def execute(cls, cmd_args): return 1 elif args.cmd == "queue": experiment_name = gen_experiment_name(args) + if args.check: + args.dry_run = True success = prepare(args, experiment_name) and ( args.dry_run or queue(args.prio, experiment_name, args.parent_folder)) if success: @@ -612,7 +616,12 @@ def prepare(args, experiment_name): print("Generating configuration variants") config_helper(["./test/helper/config-variants-generator.py", "-n", args.scenario, "echo", '{}'], variant_file, scripts_dir) + + if args.check: + subprocess.run(["./test/helper/config-variants-generator.py", args.scenario, "-d", MAIN_DIR, + "make", "check-config"], cwd=scripts_dir, check=True) else: + subprocess.run(["make", "check-config"], cwd=MAIN_DIR, check=True) with open(variant_file, "w") as f: f.write(args.scenario) diff --git a/scripts/test/helper/config-variants-generator.py b/scripts/test/helper/config-variants-generator.py index 5bd2cfb406742db22df8f41e82879eb20439404c..da885366667aee20e5980216360606635512744c 100755 --- a/scripts/test/helper/config-variants-generator.py +++ b/scripts/test/helper/config-variants-generator.py @@ -124,14 +124,10 @@ def execute(scenario): return cmd = [] - has_placeholder = False for part in SCRIPT: if part == "{}": part = scn - has_placeholder = True cmd.append(part) - if not has_placeholder: - cmd.append(scn) ret = subprocess.call(cmd, cwd=CWD) max_ret_code = max(max_ret_code, ret) @@ -175,17 +171,15 @@ def run(): 'just print the scenarios.') parser.add_argument('-v', '--verbose', action='store_true', help='Verbose printing of config modification') - parser.add_argument('-s', '--scenario', help='Only run the specified scenario. If multiple' + parser.add_argument('-s', '--scenario', help='Only run the specified scenario. If multiple ' 'configurations have the same name, all of them will be executed.') parser.add_argument('-c', '--config-file', help='Use the specified config file as source') parser.add_argument('-d', '--directory', help='Execute script in the given directory. Defaults ' 'to the current directory.') parser.add_argument('scenario_prefix', help='Prefix for the assembled scenario name, can be ' 'empty (pass an empty string: "").') - parser.add_argument('script', nargs='+', help='Command to run for every scenario. ' - 'The placeholder {} will be replaced with the scenario name. If no ' - 'placeholder exists the scenario name will be passed as the last ' - 'parameter.') + parser.add_argument('script', nargs='+', help='Command to run for every scenario. If a placeholder {} exists,' + ' then it will be replaced with the scenario name.') args = parser.parse_args() scenario_prefix = [args.scenario_prefix.strip("-")] diff --git a/src/refit/config/REFITConfigTest.java b/src/refit/config/REFITConfigTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5f1e00d70e2d7f78b96b3cccb789b1b1159f5376 --- /dev/null +++ b/src/refit/config/REFITConfigTest.java @@ -0,0 +1,14 @@ +package refit.config; + +public class REFITConfigTest { + public static void main(String[] args) { + // It doesn't matter much which config parameter is accessed + // It is only important to load and thereby initialize the REFITConfig class + if (REFITConfig.ADDRESSES.length > 0) { + System.exit(0); + } else { + System.err.println("Configuration without replicas/clients???"); + System.exit(1); + } + } +}