diff --git a/build_tools/check.sh b/build_tools/check.sh index f2e3327f0..b94661a4d 100755 --- a/build_tools/check.sh +++ b/build_tools/check.sh @@ -2,17 +2,25 @@ set -ex +cleanup () { + if [ -n "$template_file" ] && [ -e "$template_file" ]; then + rm "$template_file" + fi +} + +trap cleanup EXIT INT TERM HUP + RUSTFLAGS='-D warnings'; export RUSTFLAGS RUSTDOCFLAGS='-D warnings'; export RUSTDOCFLAGS repo_root="$(dirname "$0")/.." build_dir="$repo_root/target/debug" -cargo build --workspace --all-targets +template_file=$(mktemp) +FISH_GETTEXT_EXTRACTION_FILE=$template_file cargo build --workspace --all-targets PATH="$build_dir:$PATH" "$repo_root/build_tools/style.fish" --all --check cargo clippy --workspace --all-targets cargo test --no-default-features --workspace --all-targets cargo test --doc --workspace cargo doc --workspace - -"$repo_root/tests/test_driver.py" "$build_dir" +FISH_GETTEXT_EXTRACTION_FILE=$template_file "$repo_root/tests/test_driver.py" "$build_dir" diff --git a/tests/checks/po-files-up-to-date.fish b/tests/checks/po-files-up-to-date.fish new file mode 100644 index 000000000..bbdcedd8a --- /dev/null +++ b/tests/checks/po-files-up-to-date.fish @@ -0,0 +1,19 @@ +#RUN: fish=%fish %fish %s +#REQUIRES: msguniq --help +# Compiling in this test is too expensive. +# We need the gettext template extracted from the Rust sources passed in via env var, +# in order to pass it on. +#REQUIRES: test -e "$FISH_GETTEXT_EXTRACTION_FILE" + +set -l dir (status dirname) + +# Ensure that fish is in $PATH for the translation scripts. +set -lxp PATH (path dirname $fish) + +# Using cargo in this test is expensive because $HOME is changed, +# so the entire toolchain needs to be downloaded and installed, +# followed by a clean build of the repo. +# The `--use-existing-template` argument allows using the pre-built version of the gettext template +# file. +$dir/../../build_tools/update_translations.fish --dry-run --use-existing-template=$FISH_GETTEXT_EXTRACTION_FILE +or exit 1 diff --git a/tests/checks/check-translations.fish b/tests/checks/po-files-well-formed.fish similarity index 100% rename from tests/checks/check-translations.fish rename to tests/checks/po-files-well-formed.fish