diff --git a/.github/workflows/dart.yaml b/.github/workflows/dart.yaml index d992b209..fb3eedc0 100644 --- a/.github/workflows/dart.yaml +++ b/.github/workflows/dart.yaml @@ -28,9 +28,9 @@ jobs: steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c + - uses: dart-lang/setup-dart@a73965b3c99b30eb092908ce56c429eff91f9634 with: - sdk: 3.10.0 + sdk: 3.12.0 - run: dart pub get diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index b6116414..6e652a81 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -49,9 +49,9 @@ jobs: path: gh-cache key: ${{ runner.os }}-icu4c-binaries - name: Setup version of Dart - uses: dart-lang/setup-dart@v1 + uses: dart-lang/setup-dart@a73965b3c99b30eb092908ce56c429eff91f9634 with: - sdk: 3.10.0 + sdk: 3.12.0 - name: Set version of Rust uses: actions-rs/toolchain@v1 with: diff --git a/executors/dart/bin/executor.dart b/executors/dart/bin/executor.dart index 5973107e..9ef9c8be 100644 --- a/executors/dart/bin/executor.dart +++ b/executors/dart/bin/executor.dart @@ -7,6 +7,7 @@ import 'package:collection/collection.dart'; import 'package:dart_executor/collator.dart'; import 'package:dart_executor/datetime_format.dart'; import 'package:dart_executor/lang_names.dart'; +import 'package:dart_executor/likely_subtags.dart'; import 'package:dart_executor/list_format.dart'; import 'package:dart_executor/numberformat.dart'; import 'package:dart_executor/plural_rules.dart'; @@ -60,10 +61,7 @@ void main() { 'display_names is not supported yet', ), TestTypes.lang_names => testLangNames(line), - // TestTypes.likely_subtags => testLikelySubtags(line), - TestTypes.likely_subtags => throw UnimplementedError( - 'likely_subtags is not supported yet, as the Locale object is not yet migrated to ICU4X', - ), + TestTypes.likely_subtags => testLikelySubtags(line), TestTypes.list_fmt => testListFmt(line), TestTypes.plural_rules => testPluralRules(line), null => throw ArgumentError.value( diff --git a/executors/dart/bin/make_runnable_by_node.dart b/executors/dart/bin/make_runnable_by_node.dart index 5df91aab..9f88ee0b 100644 --- a/executors/dart/bin/make_runnable_by_node.dart +++ b/executors/dart/bin/make_runnable_by_node.dart @@ -22,6 +22,10 @@ Future main(List args) async { name: 'testPluralRules', argNames: ['encoded'], ), + 'likely_subtags': ExportFunction( + name: 'testLikelySubtags', + argNames: ['encoded'], + ), 'list_format': ExportFunction(name: 'testListFmt', argNames: ['encoded']), 'datetimeformat': ExportFunction( name: 'testDateTimeFmt', diff --git a/executors/dart/bin/web_wrappers/likely_subtags_executor.dart b/executors/dart/bin/web_wrappers/likely_subtags_executor.dart new file mode 100644 index 00000000..aeb0e1b6 --- /dev/null +++ b/executors/dart/bin/web_wrappers/likely_subtags_executor.dart @@ -0,0 +1,5 @@ +import 'package:dart_executor/likely_subtags.dart'; + +void main(List args) { + testLikelySubtags(args.first); +} diff --git a/executors/dart/lib/datetime_format.dart b/executors/dart/lib/datetime_format.dart index 9eb57b7d..4ca205c3 100644 --- a/executors/dart/lib/datetime_format.dart +++ b/executors/dart/lib/datetime_format.dart @@ -137,8 +137,8 @@ String testDateTimeFmt(String jsonEncoded) { } returnJson['actual_options'] = { 'locale': locale.toString(), - if (dateStyle != null) 'dateStyle': dateStyle, - if (timeStyle != null) 'timeStyle': timeStyle, + 'dateStyle': ?dateStyle, + 'timeStyle': ?timeStyle, if (yearStyle != null) 'yearStyle': yearStyle.name, if (calendar != null) 'calendar': calendar.jsName, }; diff --git a/executors/dart/lib/likely_subtags.dart b/executors/dart/lib/likely_subtags.dart new file mode 100644 index 00000000..7dfe3636 --- /dev/null +++ b/executors/dart/lib/likely_subtags.dart @@ -0,0 +1,4 @@ +import 'likely_subtags_native.dart' + if (dart.library.js_interop) 'likely_subtags_web.dart'; + +String testLikelySubtags(String jsonEncoded) => testLikelySubtagsImpl(jsonEncoded); diff --git a/executors/dart/lib/likely_subtags_native.dart b/executors/dart/lib/likely_subtags_native.dart new file mode 100644 index 00000000..59672243 --- /dev/null +++ b/executors/dart/lib/likely_subtags_native.dart @@ -0,0 +1,34 @@ +import 'dart:convert'; +import 'package:icu4x/icu4x.dart' as icu; + +String testLikelySubtagsImpl(String jsonEncoded) { + final json = jsonDecode(jsonEncoded) as Map; + final label = json['label']; + final localeStr = json['locale'] as String; + final option = json['option'] as String; + + final returnJson = {'label': label}; + + try { + final locale = icu.Locale.fromString(localeStr); + final expander = icu.LocaleExpander.extended(); + + if (option == 'maximize') { + expander.maximize(locale); + } else if (option == 'minimize' || option == 'minimizeFavorRegion') { + expander.minimize(locale); + } else if (option == 'minimizeFavorScript') { + expander.minimizeFavorScript(locale); + } else { + returnJson['error_type'] = 'unsupported'; + returnJson['unsupported'] = 'Unknown option: $option'; + return jsonEncode(returnJson); + } + + returnJson['result'] = locale.toString(); + } catch (e) { + returnJson['error'] = e.toString(); + } + + return jsonEncode(returnJson); +} diff --git a/executors/dart/lib/likely_subtags_web.dart b/executors/dart/lib/likely_subtags_web.dart new file mode 100644 index 00000000..e8f58a3c --- /dev/null +++ b/executors/dart/lib/likely_subtags_web.dart @@ -0,0 +1,36 @@ +import 'dart:convert'; +import 'dart:js_interop'; + +@JS('Intl.Locale') +extension type _LocaleJS._(JSObject _) implements JSObject { + external factory _LocaleJS(String s); + external _LocaleJS minimize(); + external _LocaleJS maximize(); + external String get baseName; +} + +String testLikelySubtagsImpl(String jsonEncoded) { + final json = jsonDecode(jsonEncoded) as Map; + final label = json['label']; + final localeStr = json['locale'] as String; + final option = json['option'] as String; + + final returnJson = {'label': label}; + + try { + final locale = _LocaleJS(localeStr); + if (option == 'maximize') { + returnJson['result'] = locale.maximize().baseName; + } else if (option == 'minimize' || option == 'minimizeFavorRegion') { + returnJson['result'] = locale.minimize().baseName; + } else { + returnJson['error_type'] = 'unsupported'; + returnJson['unsupported'] = 'Option $option not supported on web'; + return jsonEncode(returnJson); + } + } catch (e) { + returnJson['error'] = e.toString(); + } + + return jsonEncode(returnJson); +} diff --git a/executors/dart/lib/version.dart b/executors/dart/lib/version.dart index 012e4e6f..1df3d150 100644 --- a/executors/dart/lib/version.dart +++ b/executors/dart/lib/version.dart @@ -1,2 +1,2 @@ /// This file is autogenerated by bin/set_version.dart, do not modify manually. -const intl4xVersion = '0.17.0'; +const intl4xVersion = '1.0.0-alpha.1'; diff --git a/executors/dart/out/executor.js b/executors/dart/out/executor.js index 9fb14a78..541899f3 100644 --- a/executors/dart/out/executor.js +++ b/executors/dart/out/executor.js @@ -28,6 +28,8 @@ let datetime_fmt = require('./datetimeformat.js'); let list_fmt = require('./list_format.js'); +let likely_subtags = require('./likely_subtags.js'); + const { dartVersion } = require('./version.js') /** @@ -144,6 +146,8 @@ rl.on('line', function (line) { outputLine = datetime_fmt.testDateTimeFmt(parsedJson, doLogInput > 0, process.version); } else if (test_type == "list_fmt") { outputLine = list_fmt.testListFmt(parsedJson); + } else if (test_type == "likely_subtags") { + outputLine = likely_subtags.testLikelySubtags(parsedJson); } else { outputLine = { 'error': 'unknown test type', 'testId': testId, diff --git a/executors/dart/out/likely_subtags.js b/executors/dart/out/likely_subtags.js new file mode 100644 index 00000000..dfa074ad --- /dev/null +++ b/executors/dart/out/likely_subtags.js @@ -0,0 +1,6 @@ +var tools = require('./likely_subtagsDart'); +module.exports = { + testLikelySubtags: function (json) { + return JSON.parse(tools.testLikelySubtags(JSON.stringify(json))); + } +}; diff --git a/executors/dart/out/version.js b/executors/dart/out/version.js index 9d756391..762df9ea 100644 --- a/executors/dart/out/version.js +++ b/executors/dart/out/version.js @@ -1,2 +1,2 @@ -const dartVersion = "0.17.0"; +const dartVersion = "1.0.0-alpha.1"; module.exports = { dartVersion }; diff --git a/executors/dart/pubspec.lock b/executors/dart/pubspec.lock index 539925d1..61b70673 100644 --- a/executors/dart/pubspec.lock +++ b/executors/dart/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "5b7468c326d2f8a4f630056404ca0d291ade42918f4a3c6233618e724f39da8e" + sha256: f6526c100095fd63a916824e3da344bbbd50c25c8f56bcd52d13c59d35bbe422 url: "https://pub.dev" source: hosted - version: "92.0.0" + version: "104.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "70e4b1ef8003c64793a9e268a551a82869a8a96f39deb73dea28084b0e8bf75e" + sha256: "6c6d751533496152e78f71c46ad001260c5e74e0f9ec1f1cbc165a0467c086d6" url: "https://pub.dev" source: hosted - version: "9.0.0" + version: "14.0.0" args: dependency: transitive description: @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: async - sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 url: "https://pub.dev" source: hosted - version: "2.13.0" + version: "2.13.1" boolean_selector: dependency: transitive description: @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: code_assets - sha256: "83ccdaa064c980b5596c35dd64a8d3ecc68620174ab9b90b6343b753aa721687" + sha256: bf394f466ba9205f1812a0433b392d6af280f155f56651eda7c18cc32ed493b8 url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.2.1" collection: dependency: "direct main" description: @@ -85,10 +85,10 @@ packages: dependency: transitive description: name: coverage - sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d" + sha256: "956a3de0725ca232ad353565a8290d3357592bf4250f6f298a185e2d949c5d3d" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.15.1" crypto: dependency: transitive description: @@ -101,10 +101,10 @@ packages: dependency: transitive description: name: ffi - sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" file: dependency: transitive description: @@ -133,10 +133,10 @@ packages: dependency: transitive description: name: hooks - sha256: "5d309c86e7ce34cd8e37aa71cb30cb652d3829b900ab145e4d9da564b31d59f7" + sha256: "9a62a50b50b769a737bc0a8ff381f333529df3ab746b2f6b02e83760231455ba" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "2.0.2" http: dependency: transitive description: @@ -165,18 +165,18 @@ packages: dependency: transitive description: name: icu4x - sha256: "8c2f3ed5f860c68be13076e43685f49330956a8a8c351c9af7920606be411368" + sha256: "5a1709cbca00ded6304082292995c503d33f20544867f7226f8ee646128c4494" url: "https://pub.dev" source: hosted - version: "2.1.0-dev.1" + version: "2.2.0-dev.2" intl4x: dependency: "direct main" description: name: intl4x - sha256: "30170321747219904977b4826dbd5156e34f407876f87695d8b8167da5955d20" + sha256: "9bde13391a36b16ad25ac0c8ac3f777c47d74216973f21b59c682b9222871cd6" url: "https://pub.dev" source: hosted - version: "0.17.0" + version: "1.0.0-alpha.1" io: dependency: transitive description: @@ -189,18 +189,18 @@ packages: dependency: transitive description: name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80" url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "4.12.0" lints: dependency: "direct dev" description: name: lints - sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "6.1.0" logging: dependency: transitive description: @@ -213,18 +213,18 @@ packages: dependency: transitive description: name: matcher - sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6" + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" url: "https://pub.dev" source: hosted - version: "0.12.18" + version: "0.12.20" meta: dependency: "direct dev" description: name: meta - sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + sha256: c82594181e3312f3d0695fc95aaaf7758d75b8d4ae2bbecf223b9fd5109a059d url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.18.3" mime: dependency: transitive description: @@ -237,10 +237,10 @@ packages: dependency: transitive description: name: native_toolchain_c - sha256: "89e83885ba09da5fdf2cdacc8002a712ca238c28b7f717910b34bcd27b0d03ac" + sha256: f9c168717100ae6d9fee9ffb0be379bf1f8b26b0f6bcbd4fdddcd931993a6a72 url: "https://pub.dev" source: hosted - version: "0.17.4" + version: "0.19.2" node_preamble: dependency: "direct main" description: @@ -253,10 +253,10 @@ packages: dependency: transitive description: name: package_config - sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "3.0.0" path: dependency: transitive description: @@ -293,10 +293,10 @@ packages: dependency: transitive description: name: record_use - sha256: d3d59b18ca7aa1ce689bb3b3fd982bbebdfcd9e89f977576486a55e3b0f19a27 + sha256: "2551bd8eecfe95d14ae75f6021ad0248be5c27f138c2ec12fcb52b500b3ba1ed" url: "https://pub.dev" source: hosted - version: "0.4.2" + version: "0.6.0" shelf: dependency: transitive description: @@ -349,10 +349,10 @@ packages: dependency: transitive description: name: source_span - sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" url: "https://pub.dev" source: hosted - version: "1.10.1" + version: "1.10.2" stack_trace: dependency: transitive description: @@ -389,34 +389,34 @@ packages: dependency: "direct dev" description: name: test - sha256: "77cc98ea27006c84e71a7356cf3daf9ddbde2d91d84f77dbfe64cf0e4d9611ae" + sha256: "0d5ba5602ec3baa28c8ce365e1efc5575969c765f45c554a3e167dc7945b9c30" url: "https://pub.dev" source: hosted - version: "1.28.0" + version: "1.31.2" test_api: dependency: transitive description: name: test_api - sha256: "19a78f63e83d3a61f00826d09bc2f60e191bf3504183c001262be6ac75589fb8" + sha256: "475610b2aa23c19687cce2961e44b0cc57cafe220f67c2b80201231b2a07fbe7" url: "https://pub.dev" source: hosted - version: "0.7.8" + version: "0.7.13" test_core: dependency: transitive description: name: test_core - sha256: f1072617a6657e5fc09662e721307f7fb009b4ed89b19f47175d11d5254a62d4 + sha256: a39c204a4fc7a7ccb04a2b985e359fda3cc37e45e0b8ac61c3fb1a05aa832132 url: "https://pub.dev" source: hosted - version: "0.6.14" + version: "0.6.19" timezone: dependency: transitive description: name: timezone - sha256: dd14a3b83cfd7cb19e7888f1cbc20f258b8d71b54c06f79ac585f14093a287d1 + sha256: "981d1020d6ef8fe1e7b3de5054e5b25579ae7c403d7734adc508ffc47668e9cb" url: "https://pub.dev" source: hosted - version: "0.10.1" + version: "0.11.1" typed_data: dependency: transitive description: @@ -429,18 +429,18 @@ packages: dependency: transitive description: name: vm_service - sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + sha256: "0016aef94fc66495ac78af5859181e3f3bf2026bd8eecc72b9565601e19ab360" url: "https://pub.dev" source: hosted - version: "15.0.2" + version: "15.2.0" watcher: dependency: transitive description: name: watcher - sha256: f52385d4f73589977c80797e60fe51014f7f2b957b5e9a62c3f6ada439889249 + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" web: dependency: transitive description: @@ -482,4 +482,4 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.10.0 <4.0.0" + dart: ">=3.12.0 <4.0.0" diff --git a/executors/dart/pubspec.yaml b/executors/dart/pubspec.yaml index 0993b715..378d16c8 100644 --- a/executors/dart/pubspec.yaml +++ b/executors/dart/pubspec.yaml @@ -2,18 +2,18 @@ name: dart_executor publish_to: none environment: - sdk: ^3.10.0 + sdk: ^3.12.0 dependencies: collection: ^1.19.1 - intl4x: 0.17.0 + intl4x: 1.0.0-alpha.1 node_preamble: ^2.0.2 pubspec_lock_parse: ^2.2.0 dev_dependencies: - lints: ^6.0.0 - meta: ^1.17.0 - test: ^1.28.0 + lints: ^6.1.0 + meta: ^1.18.3 + test: ^1.31.2 hook: diff --git a/executors/dart/test/misc_test.dart b/executors/dart/test/misc_test.dart index 24f1e4f2..ab7fd661 100644 --- a/executors/dart/test/misc_test.dart +++ b/executors/dart/test/misc_test.dart @@ -9,8 +9,8 @@ import 'package:intl4x/datetime_format.dart'; import 'package:meta/meta.dart'; import 'package:test/test.dart'; -/// Run using `dart --enable-experiment=native-assets,record-use test -p chrome` for dart_web -/// and `dart --enable-experiment=native-assets,record-use test` for dart_native +/// Run using `dart --enable-experiment=record-use test -p chrome` for dart_web +/// and `dart --enable-experiment=record-use test` for dart_native void main() { testWithFormatting('Check number format output', () { diff --git a/generateDataAndRun.sh b/generateDataAndRun.sh index c5d1e42e..d3764ec6 100755 --- a/generateDataAndRun.sh +++ b/generateDataAndRun.sh @@ -12,9 +12,9 @@ logrotate -s logrotate.state logrotate.conf (while true; do echo "[$(date +%T)] --- VITALS ---" # RAM usage - echo "Memory: $(free -h | awk 'NR==2{print $3 \" / \" $2}')" + echo "Memory: $(free -h | awk 'NR==2{print \$3 \" / \" \$2}')" # Disk usage for the current workspace - echo "Disk: $(df -h . | awk 'NR==2{print $3 \" used / \" $4 \" avail (\" $5 \")\"}')" + echo "Disk: $(df -h . | awk 'NR==2{print \$3 \" used / \" \$4 \" avail (\" \$5 \")\"}')" # CPU Load echo "CPU Load: $(cut -d' ' -f1-3 /proc/loadavg)" echo "------------------------" @@ -36,7 +36,7 @@ esac echo "This machine is: ${machine}" # Ensure that ICU4C binaries have been downloaded locally -if [[ ! -d gh-cache ]] +if [ ! -d gh-cache ] || [ -z "$(ls -A gh-cache 2>/dev/null)" ] then bash setup_${machine}.sh fi @@ -73,8 +73,8 @@ mkdir -p $TEMP_DIR/testData # Generates all new test data source_file=${1:-'run_config.json'} pushd testgen -all_test_types=$(jq '.[].run.test_type' ../$source_file | jq -s '.' | jq 'add' | jq 'unique' | jq -r 'join(" ")') -all_icu_versions=$(jq '.[].run.icu_version' ../$source_file | jq -s '.' | jq 'unique' | jq -r 'join(" ")') +all_test_types=$(python3 -c "import json; d=json.load(open('../$source_file')); print(' '.join(sorted(list(set(t for e in d for t in e.get('run', {}).get('test_type', []))))))") +all_icu_versions=$(python3 -c "import json; d=json.load(open('../$source_file')); print(' '.join(sorted(list(set(e.get('run', {}).get('icu_version') for e in d if e.get('run', {}).get('icu_version'))))))") python3 testdata_gen.py --icu_versions $all_icu_versions --test_types $all_test_types # And copy results to subdirectories. cp -r icu* ../$TEMP_DIR/testData @@ -110,18 +110,19 @@ popd # TODO(?): Figure out why datasets.py can't support running multiple CLI commands, # if that is the reason why Dart needs custom handling in this end-to-end script -all_execs_json=$(jq '.[].run.exec' $source_file | jq -s '.' | jq 'unique') +all_execs_json=$(python3 -c "import json; d=json.load(open('$source_file')); print(json.dumps(sorted(list(set(e.get('run', {}).get('exec') for e in d if e.get('run', {}).get('exec'))))))") -if jq -e 'index("dart_native")' <<< $all_execs_json > /dev/null +if python3 -c "import json, sys; sys.exit(0 if 'dart_native' in json.loads(sys.stdin.read()) else 1)" <<< "$all_execs_json" > /dev/null then pushd executors/dart/ dart pub get dart bin/set_version.dart - dart build cli --target bin/executor.dart -o build/ + mkdir -p build/bundle/bin + dart compile exe bin/executor.dart -o build/bundle/bin/executor || echo "WARNING: Failed to compile dart_native" popd fi -if jq -e 'index("dart_web")' <<< $all_execs_json > /dev/null +if python3 -c "import json, sys; sys.exit(0 if 'dart_web' in json.loads(sys.stdin.read()) else 1)" <<< "$all_execs_json" > /dev/null then pushd executors/dart/ dart pub get @@ -140,19 +141,19 @@ mkdir -p $TEMP_DIR/testOutput pushd testdriver # Invoke all tests -jq -c '.[]' ../$source_file | while read i; do - if jq -e 'has("prereq")' <<< $i > /dev/null +python3 -c "import json; [print(json.dumps(x)) for x in json.load(open('../$source_file'))]" | while read i; do + if python3 -c "import json, sys; sys.exit(0 if 'prereq' in json.loads(sys.stdin.read()) else 1)" <<< "$i" > /dev/null then - command=$(jq -r -c '.prereq.command' <<< $i) + command=$(python3 -c "import json, sys; val = json.loads(sys.stdin.read()).get('prereq', {}).get('command'); print('null' if val is None else val)" <<< "$i") export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" eval "$command" fi - icu_version=$(jq -r -c '.run.icu_version' <<< $i) - exec_command=$(jq -r -c '.run.exec' <<< $i) - test_type=$(jq -r -c '.run.test_type | join(" ")' <<< $i) - per_execution=$(jq -r -c '.run.per_execution' <<< $i) - ignore=$(jq -r -c '.run.ignore' <<< $i) + icu_version=$(python3 -c "import json, sys; val = json.loads(sys.stdin.read()).get('run', {}).get('icu_version'); print('null' if val is None else val)" <<< "$i") + exec_command=$(python3 -c "import json, sys; val = json.loads(sys.stdin.read()).get('run', {}).get('exec'); print('null' if val is None else val)" <<< "$i") + test_type=$(python3 -c "import json, sys; val = json.loads(sys.stdin.read()).get('run', {}).get('test_type'); print('null' if val is None else ' '.join(val))" <<< "$i") + per_execution=$(python3 -c "import json, sys; val = json.loads(sys.stdin.read()).get('run', {}).get('per_execution'); print('null' if val is None else val)" <<< "$i") + ignore=$(python3 -c "import json, sys; val = json.loads(sys.stdin.read()).get('run', {}).get('ignore'); print('null' if val is None else val)" <<< "$i") python3 testdriver.py --icu_version $icu_version --exec $exec_command --test_type $test_type --file_base ../$TEMP_DIR --per_execution $per_execution --ignore $ignore echo $? done @@ -173,7 +174,7 @@ popd mkdir -p $TEMP_DIR/testReports pushd verifier -all_execs=$(jq -r 'join(" ")' <<< $all_execs_json) +all_execs=$(python3 -c "import json, sys; print(' '.join(json.loads(sys.stdin.read())))" <<< "$all_execs_json") # Specifies the arrangement of the columns in the summary dashboard platform_order='ICU4C ICU4J ICU4X NodeJS Dart_Web Dart_Native' diff --git a/run_config.json b/run_config.json index 3014f6a3..dad5574b 100644 --- a/run_config.json +++ b/run_config.json @@ -279,7 +279,8 @@ "number_fmt", "lang_names", "plural_rules", - "list_fmt" + "list_fmt", + "likely_subtags" ], "per_execution": 10000 } @@ -299,7 +300,8 @@ "number_fmt", "lang_names", "plural_rules", - "list_fmt" + "list_fmt", + "likely_subtags" ], "per_execution": 10000 } @@ -319,7 +321,8 @@ "number_fmt", "lang_names", "plural_rules", - "list_fmt" + "list_fmt", + "likely_subtags" ], "per_execution": 10000 } @@ -339,7 +342,8 @@ "number_fmt", "lang_names", "plural_rules", - "list_fmt" + "list_fmt", + "likely_subtags" ], "per_execution": 10000 } @@ -359,7 +363,8 @@ "number_fmt", "lang_names", "plural_rules", - "list_fmt" + "list_fmt", + "likely_subtags" ], "per_execution": 10000 } @@ -379,7 +384,8 @@ "number_fmt", "lang_names", "plural_rules", - "list_fmt" + "list_fmt", + "likely_subtags" ], "per_execution": 10000 } diff --git a/testgen/testdata_gen.py b/testgen/testdata_gen.py index 9f276122..20ada7bd 100644 --- a/testgen/testdata_gen.py +++ b/testgen/testdata_gen.py @@ -10,7 +10,11 @@ from generators.datetime_fmt import DateTimeFmtGenerator from generators.localeDisplayNames import LocaleNamesGenerator from generators.likely_subtags import LikelySubtagsGenerator -from generators.message_fmt2 import MessageFmt2Generator +try: + from generators.message_fmt2 import MessageFmt2Generator + has_message_fmt2 = True +except ImportError: + has_message_fmt2 = False from generators.list_fmt import ListFmtGenerator from generators.number_fmt import NumberFmtGenerator from generators.plurals import PluralGenerator @@ -95,8 +99,11 @@ def generate_versioned_data(version_info): generator.process_test_data() if TestType.MESSAGE_FMT2 in args.test_types: - generator = MessageFmt2Generator(icu_version, args.run_limit) - generator.process_test_data() + if not has_message_fmt2: + logger.warning("MessageFmt2Generator is not available (missing jsonschema?). Skipping.") + else: + generator = MessageFmt2Generator(icu_version, args.run_limit) + generator.process_test_data() if TestType.NUMBER_FMT in args.test_types: generator = NumberFmtGenerator(icu_version, args.run_limit)