| 1 | #!/usr/bin/env bash |
| 2 | # Check that both coqdep and coqtop/coqc support -R |
| 3 | # Check that both coqdep and coqtop/coqc takes -R preferably to installed $ROCQPATH |
| 4 | # See also bugs #2242, #2337, #2339 |
| 5 | |
| 6 | set -ex |
| 7 | |
| 8 | export PATH=$BIN:$PATH |
| 9 | |
| 10 | cd misc/deps/DistinctRoot |
| 11 | rm -rf _test |
| 12 | mkdir _test |
| 13 | find . -maxdepth 1 -not -name . -not -name _test -exec cp -r '{}' -t _test ';' |
| 14 | cd _test |
| 15 | |
| 16 | if ! rocq dep -worker @ROCQWORKER@ -R A A -R B B A/File1.v A/File11.v B/File1.v File2.v > coqdep1.real 2>&1; then |
| 17 | cat coqdep1.real |
| 18 | exit 1 |
| 19 | fi |
| 20 | diff -u --strip-trailing-cr coqdep1.out coqdep1.real || true |
| 21 | |
| 22 | touch A/File1.vo # bad vo, must not be loaded |
| 23 | rocq c -R A A -R B B A/File11.v |
| 24 | rocq c -R A A -R B B B/File1.v |
| 25 | |
| 26 | # now test with A "installed" |
| 27 | mkdir install |
| 28 | cp -r A install/A |
| 29 | export ROCQPATH=install |
| 30 | if ! rocq dep -worker @ROCQWORKER@ -R B B B/File1.v File2.v > coqdep2.real 2>&1; then |
| 31 | cat coqdep2.real |
| 32 | exit 1 |
| 33 | fi |
| 34 | diff -u --strip-trailing-cr coqdep2.out coqdep2.real |
| 35 | rocq c -R B B File2.v |
| 36 | |
| 37 | rm A/File1.vo |
| 38 | if ! rocq dep -worker @ROCQWORKER@ -R A A -R B B A/File1.v A/File11.v B/File1.v File2.v > coqdep3.real 2>&1; then |
| 39 | cat coqdep3.real |
| 40 | exit 1 |
| 41 | fi |
| 42 | # reuse coqdep1.out: output should be same as first rocq dep run |
| 43 | diff -u --strip-trailing-cr coqdep1.out coqdep3.real |
| 44 | rocq c -R A A -R B B File2.v |