diff --git a/examples/lb_data/lb_data_file_generator.cc b/examples/lb_data/lb_data_file_generator.cc index 53478a92d9..7b6ed04794 100644 --- a/examples/lb_data/lb_data_file_generator.cc +++ b/examples/lb_data/lb_data_file_generator.cc @@ -95,4 +95,4 @@ int main(int argc, char** argv) { vt::finalize(); return 0; -} \ No newline at end of file +} diff --git a/scripts/LBDatafile_schema.py b/scripts/LBDatafile_schema.py index fadb471b32..bdbbeb84d2 100644 --- a/scripts/LBDatafile_schema.py +++ b/scripts/LBDatafile_schema.py @@ -81,4 +81,4 @@ }, ] } -) \ No newline at end of file +) diff --git a/scripts/check_lb_data_files.sh b/scripts/check_lb_data_files.sh index 7c6e79e9e9..66301ef535 100755 --- a/scripts/check_lb_data_files.sh +++ b/scripts/check_lb_data_files.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -exo pipefail +set -eo pipefail path_to_vt_build_dir=${1} path_to_vt_src_dir=${2} @@ -8,7 +8,6 @@ cd "$path_to_vt_build_dir" || exit 1 function run_schema_validator() { file=$1 - echo "" echo "Running schema validator on: $file" if python3 "${path_to_vt_src_dir}/scripts/JSON_data_files_validator.py" --file_path="$file" then @@ -19,23 +18,14 @@ function run_schema_validator() { fi } -find . -iname "*.json" | grep -v "compile_commands" | while read f -do - run_schema_validator "$f" -done - -find "${path_to_vt_src_dir}/examples" -iname "*.json" | while read f -do - run_schema_validator "$f" -done - -find . -iname "*.json.br" | while read f +find . "${path_to_vt_src_dir}/examples" -iname "*.json" -o -iname "*.json.br" \ + | grep -v "compile_commands" | while read f do run_schema_validator "$f" done # Compare output of the lb_data_file_generator example with reference file -if ! python3 "${path_to_vt_src_dir}/scripts/generate_and_validate_lb_data_file.py" \ +if ! python3 "${path_to_vt_src_dir}/scripts/compare_lb_data_file.py" \ -f "${path_to_vt_build_dir}/examples/lb_data/lb_data_file_generator_1_LBDatafile.0.json" \ -r "${path_to_vt_src_dir}/examples/lb_data/lb_data_file_example.json" then diff --git a/scripts/generate_and_validate_lb_data_file.py b/scripts/compare_lb_data_file.py similarity index 79% rename from scripts/generate_and_validate_lb_data_file.py rename to scripts/compare_lb_data_file.py index 66ebd904c6..ce16b0d656 100644 --- a/scripts/generate_and_validate_lb_data_file.py +++ b/scripts/compare_lb_data_file.py @@ -7,8 +7,6 @@ def compare(file_to_validate, reference_file): """ Compares file to validate wih reference """ - print("Comparing '" + file_to_validate + "' with reference file '" + reference_file + "'.") - with open(file_to_validate) as val_file, open(reference_file) as ref_file: to_validate = json.load(val_file) reference = json.load(ref_file) @@ -16,18 +14,19 @@ def compare(file_to_validate, reference_file): is_valid = not len(diff.affected_paths) if not is_valid: + sys.stderr.write("Comparing '" + file_to_validate + "' with reference file '" + reference_file + "'... Failed!\n") sys.stderr.write("Detected differences:\n") json.dump(str(diff), sys.stderr, indent=4) sys.stderr.write("\n") sys.stderr.flush() sys.exit(1) else: - print("Comparison OK.") + print("Comparing '" + file_to_validate + "' with reference file '" + reference_file + "'... Status OK.") def main(): parser = argparse.ArgumentParser() parser.add_argument("--file-to-check", "-f", dest='file', required=True) - parser.add_argument("--reference-file", "-r", dest='reference_file', required=False) + parser.add_argument("--reference-file", "-r", dest='reference_file', required=True) args = parser.parse_args() compare(args.file, args.reference_file)