summaryrefslogtreecommitdiff
path: root/common/tests/test-compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/tests/test-compat.c')
-rw-r--r--common/tests/test-compat.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/common/tests/test-compat.c b/common/tests/test-compat.c
index f1960ce..a541235 100644
--- a/common/tests/test-compat.c
+++ b/common/tests/test-compat.c
@@ -35,6 +35,7 @@
#include "config.h"
#include "test.h"
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -56,10 +57,39 @@ test_strndup (void)
free (res);
}
+#ifdef OS_UNIX
+
+static void
+test_getauxval (void)
+{
+ /* 23 is AT_SECURE */
+ const char *args[] = { BUILDDIR "/frob-getauxval", "23", NULL };
+ char *path;
+ int ret;
+
+ ret = p11_test_run_child (args, true);
+ assert_num_eq (ret, 0);
+
+ path = p11_test_copy_setgid (args[0]);
+ if (path == NULL)
+ return;
+
+ args[0] = path;
+ ret = p11_test_run_child (args, true);
+ assert_num_cmp (ret, !=, 0);
+
+ if (unlink (path) < 0)
+ assert_fail ("unlink failed", strerror (errno));
+ free (path);
+}
+
+#endif /* OS_UNIX */
+
int
main (int argc,
char *argv[])
{
p11_test (test_strndup, "/test/strndup");
+ p11_test (test_getauxval, "/test/getauxval");
return p11_test_run (argc, argv);
}