| 1 |
|
| 2 |
# shellcheck shell=bash |
| 3 |
|
| 4 |
# For the license, see the LICENSE file in the root directory. |
| 5 |
|
| 6 |
if ! [[ "$(uname -s)" =~ Linux ]]; then |
| 7 |
echo "Need Linux to run test with CUSE interface." |
| 8 |
exit 77 |
| 9 |
fi |
| 10 |
|
| 11 |
if [ "$(id -u)" -ne 0 ]; then |
| 12 |
echo "Need to be root to run test with CUSE interface." |
| 13 |
exit 77 |
| 14 |
fi |
| 15 |
|
| 16 |
if [ -z "${SWTPM_EXE}" ]; then |
| 17 |
echo "Error: SWTPM_EXE must be set" |
| 18 |
exit 1 |
| 19 |
fi |
| 20 |
|
| 21 |
if ! ${SWTPM_EXE} --help | grep -q cuse; then |
| 22 |
echo "Skipping test: swtpm was not compiled with CUSE interface" |
| 23 |
exit 77 |
| 24 |
fi |
| 25 |
|
| 26 |
if [ ! -c /dev/cuse ]; then |
| 27 |
if ! modprobe cuse; then |
| 28 |
echo "Skipping test using CUSE module: module not available" |
| 29 |
exit 77 |
| 30 |
fi |
| 31 |
fi |