diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index d3dd7f27..e1fa671d 100755 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -26,6 +26,23 @@ while (( "$#" )); do esac done +supports_flavor() { + local fixture="$1" + local flavor="$2" + + if [[ "$flavor" == "jsi" ]]; then + return 0 + fi + + local flavor_file="${fixture}/tests/bindings/.supported-flavors.txt" + if [[ -f "$flavor_file" ]]; then + if grep -q "$flavor" "$flavor_file"; then + return 0 + fi + fi + + return 1 +} for test in "${root}"/typescript/tests/*.test.ts ; do echo "Running test $test" @@ -43,13 +60,21 @@ for fixture in ${fixtures} ; do if [[ " ${excluded_fixtures[@]} " =~ " ${fixture} " ]]; then continue fi - echo "Running fixture ${fixture}" + # This should all go in either an xtask or into our uniffi-bindgen command. # This builds the crate into the target dir. fixture_dir="${root}/fixtures/${fixture}" + + if ! supports_flavor "${fixture_dir}" "${flavor}"; then + echo "Skipping fixture ${fixture}" + continue + fi + test_file="${fixture_dir}/tests/bindings/test_${fixture//-/_}.ts" config_file="${fixture_dir}/uniffi.toml" out_dir="${fixture_dir}/generated" + + echo "Running fixture ${fixture}" rm -Rf "${out_dir}" 2>/dev/null cpp_dir="${out_dir}/cpp"