blob: db5faf229d71b3f49cd96c332f54373af23915a3 [file] [log] [blame]
#!/bin/bash -e
echo "Running tests to update data in build directory..."
# re-run tasks here because gradle may consider the task "up to date" even though the source files have changed
function run_tests() {
./gradlew --continue --rerun-tasks :test --tests="com.google.devsite.integration.BasicTest" $@
}
if run_tests $@ ; then
echo "Test data is already up to date."
exit 0
fi
echo "Updating test data..."
for dir in testData/*
do
[[ "$dir" =~ package-lists ]] && continue
if [ -d "$dir" ]; then
baseDir=$(basename "$dir")
echo "Updating test files for $dir..."
# the cp command should not fail when there are no docs (the hidden-package test)
rm -rf "testData/${baseDir}/docs" && cp -r "build/docs/testData/${baseDir}/docs" "testData/${baseDir}/docs" || true
fi
done
echo "Test data successfully updated."