2022-12-03 07:23:57 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -o errexit -o nounset -o pipefail
|
2022-03-31 00:04:35 +00:00
|
|
|
|
2022-12-03 07:23:57 +00:00
|
|
|
function run_test {
|
|
|
|
bazel run //:write_source_file_root-test
|
|
|
|
local expected_out="test-out/dist/write_source_file_root-test/test.txt"
|
|
|
|
if [ ! -e "$expected_out" ]; then
|
|
|
|
echo "ERROR: expected $expected_out to exist"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -x "$expected_out" ]; then
|
|
|
|
echo "ERROR: expected $expected_out to not be executable"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-02-17 00:59:21 +00:00
|
|
|
expected_out="test-out/dist/write_source_file_root-test_b/test.txt"
|
|
|
|
if [ ! -e "$expected_out" ]; then
|
|
|
|
echo "ERROR: expected $expected_out to exist"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -x "$expected_out" ]; then
|
|
|
|
echo "ERROR: expected $expected_out to not be executable"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-12-03 07:23:57 +00:00
|
|
|
}
|
2022-03-31 00:04:35 +00:00
|
|
|
|
2022-12-03 07:23:57 +00:00
|
|
|
# Run twice to make sure we can have permission to overwrite the outputs of a previous run
|
2022-12-03 18:52:52 +00:00
|
|
|
rm -Rf test-out
|
2022-12-03 07:23:57 +00:00
|
|
|
run_test
|
|
|
|
run_test
|
|
|
|
echo "All tests passed"
|