Skip to content

Commit

Permalink
tests: Set SWTPM_WITH_CUSE in test_config and run CUSE tests if '1'
Browse files Browse the repository at this point in the history
So that also the CUSE tests can run 'installed' set a variable
SWTPM_WITH_CUSE in test_config and make the CUSE tests now depend
on the value defined there rather than grepping through config.h.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Aug 26, 2024
1 parent 691f9d6 commit 4c534f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ if test "$with_cuse" != "no"; then
fi

dnl with_cuse is now yes or no
SWTPM_WITH_CUSE=0
if test "$with_cuse" != "no"; then
LIBFUSE_LIBS=$(pkg-config fuse --libs)
if test $? -ne 0; then
Expand All @@ -224,8 +225,10 @@ if test "$with_cuse" != "no"; then
AC_MSG_ERROR("Is glib-2.0 installed? -- could not get libs for gthread-2.0")
fi
AC_SUBST([GTHREAD_LIBS])
SWTPM_WITH_CUSE=1
fi
AM_CONDITIONAL([WITH_CUSE],[test "$with_cuse" = "yes"])
AC_SUBST([SWTPM_WITH_CUSE])
AC_MSG_RESULT($with_cuse)

JSON_GLIB_CFLAGS=$(pkg-config --cflags json-glib-1.0)
Expand Down
1 change: 1 addition & 0 deletions tests/test_config.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

TSS_USER=@TSS_USER@
TSS_GROUP=@TSS_GROUP@
SWTPM_WITH_CUSE=@SWTPM_WITH_CUSE@
4 changes: 2 additions & 2 deletions tests/test_cuse
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ if [ "$(id -u)" -ne 0 ]; then
exit 77
fi

if ! grep -q -E '#[[:blank:]]*define[[:blank:]]+WITH_CUSE[[:blank:]]+1[[:blank:]]*$' \
"${PWD}/../config.h"; then
source $(dirname "$0")/test_config
if [ "${SWTPM_WITH_CUSE}" -eq 0 ]; then
echo "Skipping test: swtpm was not compiled with CUSE interface"
exit 77
fi
Expand Down

0 comments on commit 4c534f6

Please sign in to comment.