bin: cover more tmpfile failure when running as root
* tests/core/ltlcross5.test: reorganize to test missing directory before permission issues, as the latter cannot be run as root.
This commit is contained in:
parent
e1e9f960e6
commit
95e3bb815c
1 changed files with 19 additions and 17 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2019 Laboratoire de Recherche et Développement de
|
# Copyright (C) 2019, 2023 Laboratoire de Recherche et Développement de
|
||||||
# l'Epita (LRDE).
|
# l'Epita (LRDE).
|
||||||
#
|
#
|
||||||
# This file is part of Spot, a model checking library.
|
# This file is part of Spot, a model checking library.
|
||||||
|
|
@ -24,10 +24,22 @@ set -e
|
||||||
unset TMPDIR
|
unset TMPDIR
|
||||||
unset SPOT_TMPDIR
|
unset SPOT_TMPDIR
|
||||||
|
|
||||||
|
err=0
|
||||||
|
|
||||||
|
SPOT_TMPDIR=bar ltlcross ltl2tgba -f GFa 2>err && err=1
|
||||||
|
cat err
|
||||||
|
grep 'failed to create temporary file' err
|
||||||
|
grep 'Note that the directory.*SPOT_TMPDIR ' err
|
||||||
|
|
||||||
|
TMPDIR=bar ltlcross ltl2tgba -f GFa 2>err && err=2
|
||||||
|
cat err
|
||||||
|
grep 'failed to create temporary file' err
|
||||||
|
grep 'Note that the directory.* TMPDIR ' err
|
||||||
|
|
||||||
|
|
||||||
mkdir foo
|
mkdir foo
|
||||||
chmod a-w foo
|
chmod a-w foo
|
||||||
cd foo
|
cd foo
|
||||||
err=0
|
|
||||||
if touch bar; then
|
if touch bar; then
|
||||||
# We are likely running as root, so we cannot detect permission
|
# We are likely running as root, so we cannot detect permission
|
||||||
# issues.
|
# issues.
|
||||||
|
|
@ -39,27 +51,17 @@ fi
|
||||||
ltlcross ltl2tgba -f GFa 2>../err && err=1
|
ltlcross ltl2tgba -f GFa 2>../err && err=1
|
||||||
cd ..
|
cd ..
|
||||||
cat err
|
cat err
|
||||||
grep 'failed to create temporary file' err || err=1
|
grep 'failed to create temporary file' err || err=3
|
||||||
grep 'executing this from a writable' err || err=1
|
grep 'executing this from a writable' err || err=3
|
||||||
grep 'SPOT_TMPDIR' err || err=1
|
grep 'SPOT_TMPDIR' err || err=1
|
||||||
|
|
||||||
SPOT_TMPDIR=foo ltlcross ltl2tgba -f GFa 2>err && err=2
|
SPOT_TMPDIR=foo ltlcross ltl2tgba -f GFa 2>err && err=4
|
||||||
cat err
|
cat err
|
||||||
grep 'failed to create temporary file' err || err=2
|
grep 'failed to create temporary file' err || err=4
|
||||||
grep 'executing this from a writable' err && err=2
|
grep 'executing this from a writable' err && err=4
|
||||||
grep 'SPOT_TMPDIR' err
|
grep 'SPOT_TMPDIR' err
|
||||||
|
|
||||||
chmod a+w foo
|
chmod a+w foo
|
||||||
rmdir foo
|
rmdir foo
|
||||||
|
|
||||||
SPOT_TMPDIR=bar ltlcross ltl2tgba -f GFa 2>err && err=3
|
|
||||||
cat err
|
|
||||||
grep 'failed to create temporary file' err
|
|
||||||
grep 'Note that the directory.*SPOT_TMPDIR ' err
|
|
||||||
|
|
||||||
TMPDIR=bar ltlcross ltl2tgba -f GFa 2>err && err=4
|
|
||||||
cat err
|
|
||||||
grep 'failed to create temporary file' err
|
|
||||||
grep 'Note that the directory.* TMPDIR ' err
|
|
||||||
|
|
||||||
exit $err
|
exit $err
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue