Repository navigation
Expand file tree
/
Copy pathupdate_expected_output.sh
More file actions
executable file
·89 lines (81 loc) · 2.65 KB
/
Copy pathupdate_expected_output.sh
File metadata and controls
executable file
·89 lines (81 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
srcdir="$1"
builddir="$2"
expected_dir="$1/expected"
mkdir -p "${expected_dir}"
# expected/Makefile.am uses a `dist-hook` to bulk-glob *.out / *.err
# into the distdir instead of an explicit per-file `dist_noinst_DATA`
# list. The explicit form expanded to >128KB of recipe text and
# tripped Linux's MAX_ARG_STRLEN, breaking `make dist` with
# `bash: Argument list too long`. We no longer touch the Makefile.am
# from this script — the dist-hook picks up new fixtures automatically.
for fname in $(ls -t ${builddir}/*.cmd); do
echo
echo "Checking test ${fname}:"
echo -n " "
cat "${fname}"
stem=$(echo $fname | sed -e 's/.cmd$//')
exp_stem="${srcdir}/expected/$(basename $stem)"
if ! test -f "${exp_stem}.out"; then
printf '\033[0;32mBEGIN\033[0m %s.out\n' "${stem}"
cat "${stem}.out"
printf '\033[0;32mEND\033[0m %s.out\n' "${stem}"
if test x"${AUTO_APPROVE}" = x""; then
echo "Expected stdout is missing, update with the above?"
select yn in "Yes" "No"; do
case $yn in
Yes ) cp "${stem}.out" "${exp_stem}.out"; break;;
No ) exit;;
esac
done
else
cp "${stem}.out" "${exp_stem}.out"
fi
else
if ! cmp "${exp_stem}.out" "${stem}.out"; then
git diff --color-words --color=always -u "${exp_stem}.out" "${stem}.out"
if test x"${AUTO_APPROVE}" = x""; then
echo "Expected stdout is different, update with the above?"
select yn in "Yes" "No"; do
case $yn in
Yes ) cp "${stem}.out" "${exp_stem}.out"; break;;
No ) exit;;
esac
done
else
cp "${stem}.out" "${exp_stem}.out"
fi
fi
fi
if ! test -f "${exp_stem}.err"; then
printf '\033[0;31mBEGIN\033[0m %s.err\n' "${stem}"
cat "${stem}.err"
printf '\033[0;31mEND\033[0m %s.err\n' "${stem}"
if test x"${AUTO_APPROVE}" = x""; then
echo "Expected stderr is missing, update with the above?"
select yn in "Yes" "No"; do
case $yn in
Yes ) cp "${stem}.err" "${exp_stem}.err"; break;;
No ) exit;;
esac
done
else
cp "${stem}.err" "${exp_stem}.err"
fi
else
if ! cmp "${exp_stem}.err" "${stem}.err"; then
git diff --color-words --color=always -u "${exp_stem}.err" "${stem}.err"
if test x"${AUTO_APPROVE}" = x""; then
echo "Expected stderr is different, update with the above?"
select yn in "Yes" "No"; do
case $yn in
Yes ) cp "${stem}.err" "${exp_stem}.err"; break;;
No ) exit;;
esac
done
else
cp "${stem}.err" "${exp_stem}.err"
fi
fi
fi
done