From 7b56a6bebc672c62f889c61346aea0cab8643a60 Mon Sep 17 00:00:00 2001 From: Drew Paroski Date: Fri, 27 Sep 2024 17:08:03 -0400 Subject: [PATCH] SERVER-95076 Add deterministic versions of several fuzzers to "query/tasks.yml" (#27336) GitOrigin-RevId: 5da46df759cef1eb157bb315ba01118ff43db047 --- ...n_fuzzer_deterministic_last_continuous.yml | 26 ++++ ...iversion_fuzzer_deterministic_last_lts.yml | 26 ++++ ...lication_deterministic_last_continuous.yml | 22 +++ ...zer_replication_deterministic_last_lts.yml | 22 +++ ...n_fuzzer_deterministic_last_continuous.yml | 3 + ...iversion_fuzzer_deterministic_last_lts.yml | 3 + ...lication_deterministic_last_continuous.yml | 1 + ...zer_replication_deterministic_last_lts.yml | 1 + .../resmoke/server_divisions/query/tasks.yml | 147 ++++++++++++++++++ .../variants/amazon/test_dev.yml | 1 + .../variants/rhel/test_dev.yml | 4 +- .../rhel/test_dev_master_branch_only.yml | 4 +- .../variants/sanitizer/test_dev.yml | 4 +- .../sanitizer/test_dev_master_branch_only.yml | 4 +- evergreen/jstestfuzz_run.sh | 55 ++++++- 15 files changed, 314 insertions(+), 9 deletions(-) create mode 100644 buildscripts/resmokeconfig/matrix_suites/generated_suites/aggregation_multiversion_fuzzer_deterministic_last_continuous.yml create mode 100644 buildscripts/resmokeconfig/matrix_suites/generated_suites/aggregation_multiversion_fuzzer_deterministic_last_lts.yml create mode 100644 buildscripts/resmokeconfig/matrix_suites/generated_suites/update_fuzzer_replication_deterministic_last_continuous.yml create mode 100644 buildscripts/resmokeconfig/matrix_suites/generated_suites/update_fuzzer_replication_deterministic_last_lts.yml create mode 100644 buildscripts/resmokeconfig/matrix_suites/mappings/aggregation_multiversion_fuzzer_deterministic_last_continuous.yml create mode 100644 buildscripts/resmokeconfig/matrix_suites/mappings/aggregation_multiversion_fuzzer_deterministic_last_lts.yml create mode 100644 buildscripts/resmokeconfig/matrix_suites/mappings/update_fuzzer_replication_deterministic_last_continuous.yml create mode 100644 buildscripts/resmokeconfig/matrix_suites/mappings/update_fuzzer_replication_deterministic_last_lts.yml diff --git a/buildscripts/resmokeconfig/matrix_suites/generated_suites/aggregation_multiversion_fuzzer_deterministic_last_continuous.yml b/buildscripts/resmokeconfig/matrix_suites/generated_suites/aggregation_multiversion_fuzzer_deterministic_last_continuous.yml new file mode 100644 index 00000000000..3785bf11f0f --- /dev/null +++ b/buildscripts/resmokeconfig/matrix_suites/generated_suites/aggregation_multiversion_fuzzer_deterministic_last_continuous.yml @@ -0,0 +1,26 @@ +########################################################## +# THIS IS A GENERATED FILE -- DO NOT MODIFY. +# IF YOU WISH TO MODIFY THIS SUITE, MODIFY THE CORRESPONDING MATRIX SUITE MAPPING FILE +# AND REGENERATE THE MATRIX SUITES. +# +# matrix suite mapping file: buildscripts/resmokeconfig/matrix_suites/mappings/aggregation_multiversion_fuzzer_deterministic_last_continuous.yml +# regenerate matrix suites: buildscripts/resmoke.py generate-matrix-suites && bazel run //:format +########################################################## +executor: + archive: + tests: true + config: + shell_options: + global_vars: + TestData: + clusterType: standalone + internalQueryAppendIdToSetWindowFieldsSort: true + internalQueryMaxAllowedDensifyDocs: 1000 + traceExceptions: false + useRandomBinVersionsWithinReplicaSet: last-continuous + nodb: "" +matrix_suite: true +selector: + roots: + - jstestfuzz/out/*.js +test_kind: js_test diff --git a/buildscripts/resmokeconfig/matrix_suites/generated_suites/aggregation_multiversion_fuzzer_deterministic_last_lts.yml b/buildscripts/resmokeconfig/matrix_suites/generated_suites/aggregation_multiversion_fuzzer_deterministic_last_lts.yml new file mode 100644 index 00000000000..c1a56a01848 --- /dev/null +++ b/buildscripts/resmokeconfig/matrix_suites/generated_suites/aggregation_multiversion_fuzzer_deterministic_last_lts.yml @@ -0,0 +1,26 @@ +########################################################## +# THIS IS A GENERATED FILE -- DO NOT MODIFY. +# IF YOU WISH TO MODIFY THIS SUITE, MODIFY THE CORRESPONDING MATRIX SUITE MAPPING FILE +# AND REGENERATE THE MATRIX SUITES. +# +# matrix suite mapping file: buildscripts/resmokeconfig/matrix_suites/mappings/aggregation_multiversion_fuzzer_deterministic_last_lts.yml +# regenerate matrix suites: buildscripts/resmoke.py generate-matrix-suites && bazel run //:format +########################################################## +executor: + archive: + tests: true + config: + shell_options: + global_vars: + TestData: + clusterType: standalone + internalQueryAppendIdToSetWindowFieldsSort: true + internalQueryMaxAllowedDensifyDocs: 1000 + traceExceptions: false + useRandomBinVersionsWithinReplicaSet: last-lts + nodb: "" +matrix_suite: true +selector: + roots: + - jstestfuzz/out/*.js +test_kind: js_test diff --git a/buildscripts/resmokeconfig/matrix_suites/generated_suites/update_fuzzer_replication_deterministic_last_continuous.yml b/buildscripts/resmokeconfig/matrix_suites/generated_suites/update_fuzzer_replication_deterministic_last_continuous.yml new file mode 100644 index 00000000000..ba9b9839ad2 --- /dev/null +++ b/buildscripts/resmokeconfig/matrix_suites/generated_suites/update_fuzzer_replication_deterministic_last_continuous.yml @@ -0,0 +1,22 @@ +########################################################## +# THIS IS A GENERATED FILE -- DO NOT MODIFY. +# IF YOU WISH TO MODIFY THIS SUITE, MODIFY THE CORRESPONDING MATRIX SUITE MAPPING FILE +# AND REGENERATE THE MATRIX SUITES. +# +# matrix suite mapping file: buildscripts/resmokeconfig/matrix_suites/mappings/update_fuzzer_replication_deterministic_last_continuous.yml +# regenerate matrix suites: buildscripts/resmoke.py generate-matrix-suites && bazel run //:format +########################################################## +executor: + archive: + tests: true + config: + shell_options: + global_vars: + TestData: + clusterType: replset + nodb: "" +matrix_suite: true +selector: + roots: + - jstestfuzz/out/*.js +test_kind: js_test diff --git a/buildscripts/resmokeconfig/matrix_suites/generated_suites/update_fuzzer_replication_deterministic_last_lts.yml b/buildscripts/resmokeconfig/matrix_suites/generated_suites/update_fuzzer_replication_deterministic_last_lts.yml new file mode 100644 index 00000000000..3f093490dbf --- /dev/null +++ b/buildscripts/resmokeconfig/matrix_suites/generated_suites/update_fuzzer_replication_deterministic_last_lts.yml @@ -0,0 +1,22 @@ +########################################################## +# THIS IS A GENERATED FILE -- DO NOT MODIFY. +# IF YOU WISH TO MODIFY THIS SUITE, MODIFY THE CORRESPONDING MATRIX SUITE MAPPING FILE +# AND REGENERATE THE MATRIX SUITES. +# +# matrix suite mapping file: buildscripts/resmokeconfig/matrix_suites/mappings/update_fuzzer_replication_deterministic_last_lts.yml +# regenerate matrix suites: buildscripts/resmoke.py generate-matrix-suites && bazel run //:format +########################################################## +executor: + archive: + tests: true + config: + shell_options: + global_vars: + TestData: + clusterType: replset + nodb: "" +matrix_suite: true +selector: + roots: + - jstestfuzz/out/*.js +test_kind: js_test diff --git a/buildscripts/resmokeconfig/matrix_suites/mappings/aggregation_multiversion_fuzzer_deterministic_last_continuous.yml b/buildscripts/resmokeconfig/matrix_suites/mappings/aggregation_multiversion_fuzzer_deterministic_last_continuous.yml new file mode 100644 index 00000000000..8e38541e945 --- /dev/null +++ b/buildscripts/resmokeconfig/matrix_suites/mappings/aggregation_multiversion_fuzzer_deterministic_last_continuous.yml @@ -0,0 +1,3 @@ +base_suite: generational_fuzzer +overrides: + - "multiversion.replica_sets_multiversion_testdata_last_continuous" diff --git a/buildscripts/resmokeconfig/matrix_suites/mappings/aggregation_multiversion_fuzzer_deterministic_last_lts.yml b/buildscripts/resmokeconfig/matrix_suites/mappings/aggregation_multiversion_fuzzer_deterministic_last_lts.yml new file mode 100644 index 00000000000..d3863bfd6af --- /dev/null +++ b/buildscripts/resmokeconfig/matrix_suites/mappings/aggregation_multiversion_fuzzer_deterministic_last_lts.yml @@ -0,0 +1,3 @@ +base_suite: generational_fuzzer +overrides: + - "multiversion.replica_sets_multiversion_testdata_last_lts" diff --git a/buildscripts/resmokeconfig/matrix_suites/mappings/update_fuzzer_replication_deterministic_last_continuous.yml b/buildscripts/resmokeconfig/matrix_suites/mappings/update_fuzzer_replication_deterministic_last_continuous.yml new file mode 100644 index 00000000000..63338f54438 --- /dev/null +++ b/buildscripts/resmokeconfig/matrix_suites/mappings/update_fuzzer_replication_deterministic_last_continuous.yml @@ -0,0 +1 @@ +base_suite: update_fuzzer_replication diff --git a/buildscripts/resmokeconfig/matrix_suites/mappings/update_fuzzer_replication_deterministic_last_lts.yml b/buildscripts/resmokeconfig/matrix_suites/mappings/update_fuzzer_replication_deterministic_last_lts.yml new file mode 100644 index 00000000000..63338f54438 --- /dev/null +++ b/buildscripts/resmokeconfig/matrix_suites/mappings/update_fuzzer_replication_deterministic_last_lts.yml @@ -0,0 +1 @@ +base_suite: update_fuzzer_replication diff --git a/etc/evergreen_yml_components/tasks/resmoke/server_divisions/query/tasks.yml b/etc/evergreen_yml_components/tasks/resmoke/server_divisions/query/tasks.yml index 197152d4bc8..e79d8c3b9cf 100644 --- a/etc/evergreen_yml_components/tasks/resmoke/server_divisions/query/tasks.yml +++ b/etc/evergreen_yml_components/tasks/resmoke/server_divisions/query/tasks.yml @@ -242,6 +242,47 @@ tasks: npm_command: agg-fuzzer run_no_feature_flag_tests: "true" + ## Like "aggregation_multiversion_fuzzer_gen", but it uses a pinned git revision for the + ## "jstestfuzz" repo and it uses a fixed seed. + - <<: *jstestfuzz_template + name: aggregation_multiversion_fuzzer_deterministic_gen + tags: + [ + "assigned_to_jira_team_server_query_execution", + "release_critical", + "fuzzer_deterministic", + "common", + "multiversion", + "incompatible_mac", + "incompatible_ppc", + "incompatible_s390x", + "incompatible_windows", + "incompatible_tsan", + "incompatible_aubsan", + "incompatible_debug_mode", + "require_npm", + "random_name", + "future_git_tag_incompatible", + ] + commands: + - func: "initialize multiversion tasks" + vars: + aggregation_multiversion_fuzzer_deterministic_last_lts: last_lts + aggregation_multiversion_fuzzer_deterministic_last_continuous: last_continuous + - func: "generate resmoke tasks" + vars: + <<: *jstestfuzz_config_vars + # This task used a fixed git revision for the jstestfuzz repo. As changes are made + # to the mongo repo over time, the fixed jstestfuzz git rev used here will need to + # be updated every so often (once every few months). + num_files: 24 + num_tasks: 2 + npm_command: agg-fuzzer + suite: aggregation_multiversion_fuzzer + resmoke_args: "--mongodSetParameters='{logComponentVerbosity: {command: 2}}'" + jstestfuzz_vars: --metaSeed 1726779665485 --jstestfuzzGitRev 8ddd8f12cab0 + run_no_feature_flag_tests: "true" + - <<: *task_template name: aggregation_one_shard_sharded_collections tags: @@ -360,6 +401,41 @@ tasks: suite: generational_fuzzer resmoke_args: "--mongodSetParameters='{logComponentVerbosity: {command: 2}}'" + ## Like "aggregation_timeseries_fuzzer_gen", but it uses a pinned git revision for the + ## "jstestfuzz" repo and it uses a fixed seed. + - <<: *jstestfuzz_template + name: aggregation_timeseries_fuzzer_deterministic_gen + tags: + [ + "assigned_to_jira_team_server_query_execution", + "release_critical", + "fuzzer_deterministic", + "common", + "timeseries", + "incompatible_mac", + "incompatible_ppc", + "incompatible_s390x", + "incompatible_windows", + "incompatible_tsan", + "incompatible_aubsan", + "incompatible_debug_mode", + "require_npm", + "random_name", + ] + commands: + - func: "generate resmoke tasks" + vars: + <<: *jstestfuzz_config_vars + # This task used a fixed git revision for the jstestfuzz repo. As changes are made + # to the mongo repo over time, the fixed jstestfuzz git rev used here will need to + # be updated every so often (once every few months). + num_files: 60 + num_tasks: 2 + npm_command: agg-fuzzer + suite: generational_fuzzer + resmoke_args: "--mongodSetParameters='{logComponentVerbosity: {command: 2}}'" + jstestfuzz_vars: --diffTestingMode timeseries --numPipelines=1000 --metaSeed 1726779665485 --jstestfuzzGitRev 8ddd8f12cab0 + ## Standalone fuzzer for checking block_processing correctness ## - <<: *jstestfuzz_template name: aggregation_blockprocessing_fuzzer_gen @@ -1115,6 +1191,46 @@ tasks: resmoke_args: "--mongodSetParameters='{logComponentVerbosity: {command: 2}}'" run_no_feature_flag_tests: "true" + ## Like "update_fuzzer_replication_gen", but it uses a pinned git revision for the "jstestfuzz" + ## repo and it uses a fixed seed. + - <<: *jstestfuzz_template + name: update_fuzzer_replication_deterministic_gen + tags: + [ + "assigned_to_jira_team_server_query_execution", + "release_critical", + "fuzzer_deterministic", + "multiversion", + "incompatible_mac", + "incompatible_ppc", + "incompatible_s390x", + "incompatible_windows", + "incompatible_tsan", + "incompatible_aubsan", + "incompatible_debug_mode", + "require_npm", + "random_name", + "future_git_tag_incompatible", + ] + commands: + - func: "initialize multiversion tasks" + vars: + update_fuzzer_replication_deterministic_last_lts: last_lts + update_fuzzer_replication_deterministic_last_continuous: last_continuous + - func: "generate resmoke tasks" + vars: + <<: *jstestfuzz_config_vars + # This task used a fixed git revision for the jstestfuzz repo. As changes are made + # to the mongo repo over time, the fixed jstestfuzz git rev used here will need to + # be updated every so often (once every few months). + num_files: 16 + num_tasks: 2 + npm_command: update-fuzzer + suite: update_fuzzer_replication + resmoke_args: "--mongodSetParameters='{logComponentVerbosity: {command: 2}}'" + jstestfuzz_vars: --metaSeed 1726779665485 --jstestfuzzGitRev 8ddd8f12cab0 + run_no_feature_flag_tests: "true" + # jstestfuzz standalone update time-series generational fuzzer ## - <<: *jstestfuzz_template name: update_timeseries_fuzzer_gen @@ -1211,6 +1327,37 @@ tasks: resmoke_args: "--mongodSetParameters='{logComponentVerbosity: {command: 2}}'" npm_command: agg-fuzzer + ## Like "aggregation_optimization_fuzzer_gen", but it uses a pinned git revision for the + ## "jstestfuzz" repo and it uses a fixed seed. + - <<: *jstestfuzz_template + name: aggregation_optimization_fuzzer_deterministic_gen + tags: + [ + "assigned_to_jira_team_server_query_optimization", + "release_critical", + "fuzzer_deterministic", + "optimization", + "incompatible_mac", + "incompatible_ppc", + "incompatible_s390x", + "incompatible_windows", + "incompatible_tsan", + "incompatible_aubsan", + "incompatible_debug_mode", + "require_npm", + "random_name", + ] + commands: + - func: "generate resmoke tasks" + vars: + <<: *jstestfuzz_config_vars + num_files: 14 + num_tasks: 2 + npm_command: agg-fuzzer + suite: generational_fuzzer + resmoke_args: "--mongodSetParameters='{logComponentVerbosity: {command: 2}}'" + jstestfuzz_vars: --diffTestingMode optimization --metaSeed 1726779665485 --jstestfuzzGitRev 8ddd8f12cab0 + - <<: *task_template name: aggregation_repeat_queries_multiplan_single_solutions tags: ["assigned_to_jira_team_server_query_optimization", "default"] diff --git a/etc/evergreen_yml_components/variants/amazon/test_dev.yml b/etc/evergreen_yml_components/variants/amazon/test_dev.yml index 812c4164720..b160bfc9c51 100644 --- a/etc/evergreen_yml_components/variants/amazon/test_dev.yml +++ b/etc/evergreen_yml_components/variants/amazon/test_dev.yml @@ -250,3 +250,4 @@ buildvariants: - name: concurrency_gen - name: concurrency_replication_gen - name: concurrency_sharded_replication_gen + - name: .fuzzer_deterministic diff --git a/etc/evergreen_yml_components/variants/rhel/test_dev.yml b/etc/evergreen_yml_components/variants/rhel/test_dev.yml index 37d378f9bf0..2dba061d11c 100644 --- a/etc/evergreen_yml_components/variants/rhel/test_dev.yml +++ b/etc/evergreen_yml_components/variants/rhel/test_dev.yml @@ -131,8 +131,8 @@ buildvariants: - name: .development_critical .requires_large_host !.requires_compile_variant !.incompatible_development_variant !.requires_all_feature_flags distros: - rhel8.8-medium - - name: .release_critical !.requires_large_host !.requires_compile_variant !.incompatible_development_variant !.requires_all_feature_flags - - name: .release_critical .requires_large_host !.requires_compile_variant !.incompatible_development_variant !.requires_all_feature_flags + - name: .release_critical !.requires_large_host !.requires_compile_variant !.incompatible_development_variant !.requires_all_feature_flags !.fuzzer_deterministic + - name: .release_critical .requires_large_host !.requires_compile_variant !.incompatible_development_variant !.requires_all_feature_flags !.fuzzer_deterministic distros: - rhel8.8-medium - name: .default !.requires_large_host !.requires_compile_variant !.incompatible_development_variant !.requires_all_feature_flags diff --git a/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml b/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml index 23674765e76..8ed90511b47 100644 --- a/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml +++ b/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml @@ -316,8 +316,8 @@ buildvariants: - name: .development_critical .requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_all_feature_flags distros: - rhel8.8-medium - - name: .release_critical !.requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_all_feature_flags - - name: .release_critical .requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_all_feature_flags + - name: .release_critical !.requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_all_feature_flags !.fuzzer_deterministic + - name: .release_critical .requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_all_feature_flags !.fuzzer_deterministic distros: - rhel8.8-medium - name: .default !.requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_all_feature_flags diff --git a/etc/evergreen_yml_components/variants/sanitizer/test_dev.yml b/etc/evergreen_yml_components/variants/sanitizer/test_dev.yml index e6eb47f3c7c..9fa7c022082 100644 --- a/etc/evergreen_yml_components/variants/sanitizer/test_dev.yml +++ b/etc/evergreen_yml_components/variants/sanitizer/test_dev.yml @@ -320,8 +320,8 @@ buildvariants: - name: .development_critical .requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_community !.requires_all_feature_flags !.suggested_excluding_required__for_devprod_mitigation_only distros: - rhel8.8-medium - - name: .release_critical !.requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_community !.requires_all_feature_flags !.suggested_excluding_required__for_devprod_mitigation_only - - name: .release_critical .requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_community !.requires_all_feature_flags !.suggested_excluding_required__for_devprod_mitigation_only + - name: .release_critical !.requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_community !.requires_all_feature_flags !.fuzzer_deterministic !.suggested_excluding_required__for_devprod_mitigation_only + - name: .release_critical .requires_large_host !.requires_compile_variant !.incompatible_development_variant !.incompatible_community !.requires_all_feature_flags !.fuzzer_deterministic !.suggested_excluding_required__for_devprod_mitigation_only distros: - rhel8.8-medium diff --git a/etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml b/etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml index 44efae2c995..24a5ddda8f0 100644 --- a/etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml +++ b/etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml @@ -311,8 +311,8 @@ buildvariants: - name: .development_critical .requires_large_host !.incompatible_development_variant !.incompatible_community !.incompatible_windows !.requires_all_feature_flags distros: - windows-2022-large - - name: .release_critical !.requires_large_host !.incompatible_development_variant !.incompatible_community !.incompatible_windows !.requires_all_feature_flags - - name: .release_critical .requires_large_host !.incompatible_development_variant !.incompatible_community !.incompatible_windows !.requires_all_feature_flags + - name: .release_critical !.requires_large_host !.incompatible_development_variant !.incompatible_community !.incompatible_windows !.requires_all_feature_flags !.fuzzer_deterministic + - name: .release_critical .requires_large_host !.incompatible_development_variant !.incompatible_community !.incompatible_windows !.requires_all_feature_flags !.fuzzer_deterministic distros: - windows-2022-large diff --git a/evergreen/jstestfuzz_run.sh b/evergreen/jstestfuzz_run.sh index 57521f42825..1c7e16c1ab3 100644 --- a/evergreen/jstestfuzz_run.sh +++ b/evergreen/jstestfuzz_run.sh @@ -5,6 +5,59 @@ set -evo pipefail cd src/jstestfuzz +# Store 'jstestfuzz_vars' into 'vars'. We will use 'vars' instead of 'jstestfuzz_vars' for +# the rest of this shell script. +vars="${jstestfuzz_vars}" + +# If the "--jstestfuzzGitRev" option is present in 'vars', copy the option's value into +# 'jstestfuzz_gitrev' and remove it from 'vars', and then reset the jstestfuzz repo to the +# specified git revision. +echo "${vars}" | grep -q -- '--jstestfuzzGitRev[ \t]\+[A-Za-z0-9]\+' && RET=0 || RET=$? +if [ $RET -eq 0 ]; then + jstestfuzz_gitrev=$(echo "${vars}" | sed -e 's/.*--jstestfuzzGitRev[ \t]\+\([A-Za-z0-9]\+\).*/\1/') + vars=$(echo "${vars}" | sed -e 's/\(.*\)--jstestfuzzGitRev[ \t]\+[A-Za-z0-9]\+\(.*\)/\1\2/') + + for i in {1..5}; do + git reset --hard "${jstestfuzz_gitrev}" && RET=0 && break || RET=$? && sleep 5 + echo "Failed to reset jstestfuzz to git revision ${jstestfuzz_gitrev}, retrying..." + done + + if [ $RET -ne 0 ]; then + echo "Failed to reset jstestfuzz to git revision ${jstestfuzz_gitrev}" + exit $RET + fi +fi + +# If the "--metaSeed" option is present in 'vars', copy the option's value into 'meta_seed' +# and remove it from 'vars', and then generate a seed using 'meta_seed' and 'task_name' and +# pass this generated seed to "npm_run.sh" below. +generated_seed_flag="" +echo "${vars}" | grep -q -- '--metaSeed[ \t]\+[0-9]\+' && RET=0 || RET=$? +if [ $RET -eq 0 ]; then + # Throw an error if the "--seed" option and the "--metaSeed" option are both present. + echo "${vars}" | grep -q -- '--seed[ \t]\+[0-9]\+' && RET=0 || RET=$? + if [ $RET -eq 0 ]; then + echo "Cannot use the --seed option and the --metaSeed option together" + exit 1 + fi + + # Store the meta seed value into 'meta_seed' and remove the "--metaSeed" option from 'vars'. + meta_seed=$(echo "${vars}" | sed -e 's/.*--metaSeed[ \t]\+\([0-9]\+\).*/\1/') + vars=$(echo "${vars}" | sed -e 's/\(.*\)--metaSeed[ \t]\+[0-9]\+\(.*\)/\1\2/') + + # If 'task_name' matches the pattern that we use for generated task names, extract the number + # from 'task_name' and generate a seed using this number and 'meta_seed' together. Otherwise, + # just use 'meta_seed' itself for the seed. + echo "${task_name}" | grep -q '_[0-9]\+\(-.*\)\?$' && RET=0 || RET=$? + if [ $RET -eq 0 ]; then + task_num=$(echo "${task_name}" | sed -e 's/.*_\([0-9]\+\)\(-.*\)\?$/\1/') + generated_seed=$((meta_seed + 971 * (task_num + 1))) + generated_seed_flag="--seed ${generated_seed}" + else + generated_seed_flag="--seed ${meta_seed}" + fi +fi + in_patch_build_flag="" if [[ "${is_patch}" = "true" ]]; then case "${npm_command}" in @@ -20,4 +73,4 @@ if [[ "${npm_command}" != "jstestfuzz" ]]; then maybe_use_es_modules="--useEsModules" fi -./src/scripts/npm_run.sh ${npm_command} -- ${jstestfuzz_vars} ${in_patch_build_flag} ${maybe_use_es_modules} --branch ${branch_name} +./src/scripts/npm_run.sh ${npm_command} -- ${vars} ${generated_seed_flag} ${in_patch_build_flag} ${maybe_use_es_modules} --branch ${branch_name}