Add PO file update check to tests

The PO file updates can now run in a normal test, eliminating the need for
special handling.

Rename the `check-translations.fish` script, to clarify which part of the checks
happens in it.
This commit is contained in:
Daniel Rainer
2025-06-11 18:03:13 +02:00
parent 85fb937a4d
commit 80131acff2
3 changed files with 30 additions and 3 deletions

View File

@@ -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"

View File

@@ -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