From 48ce6b94f4fe5131242ba87485cd79e081a991ed Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 18:04:52 +0000 Subject: Only run SELinux test if support for SELinux was detected at configure time. --- test/Runtime/POSIX/SELinux.c | 30 ------------------------------ test/Runtime/POSIX/SELinux/SELinux.c | 30 ++++++++++++++++++++++++++++++ test/Runtime/POSIX/SELinux/lit.local.cfg | 7 +++++++ 3 files changed, 37 insertions(+), 30 deletions(-) delete mode 100644 test/Runtime/POSIX/SELinux.c create mode 100644 test/Runtime/POSIX/SELinux/SELinux.c create mode 100644 test/Runtime/POSIX/SELinux/lit.local.cfg (limited to 'test/Runtime') diff --git a/test/Runtime/POSIX/SELinux.c b/test/Runtime/POSIX/SELinux.c deleted file mode 100644 index 65dd1a7f..00000000 --- a/test/Runtime/POSIX/SELinux.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Very basic test, as right now SELinux support is extremely basic */ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee --posix-runtime --exit-on-error %t1.bc --sym-arg 2 > %t.log -// XFAIL: no-selinux - -#include -#include -#include - -int main(int argc, char** argv) { - - security_context_t con; - - assert(argc == 2); - - int selinux = is_selinux_enabled(); - printf("selinux enabled = %d\n", selinux); - - if (setfscreatecon(argv[1]) < 0) - printf("Error: set\n"); - else printf("Success: set\n"); - - if (getfscreatecon(&con) < 0) - printf("Error: get\n"); - else printf("Success: get\n"); - - printf("create_con = %s\n", con); - - return 0; -} diff --git a/test/Runtime/POSIX/SELinux/SELinux.c b/test/Runtime/POSIX/SELinux/SELinux.c new file mode 100644 index 00000000..65dd1a7f --- /dev/null +++ b/test/Runtime/POSIX/SELinux/SELinux.c @@ -0,0 +1,30 @@ +/* Very basic test, as right now SELinux support is extremely basic */ +// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc +// RUN: %klee --posix-runtime --exit-on-error %t1.bc --sym-arg 2 > %t.log +// XFAIL: no-selinux + +#include +#include +#include + +int main(int argc, char** argv) { + + security_context_t con; + + assert(argc == 2); + + int selinux = is_selinux_enabled(); + printf("selinux enabled = %d\n", selinux); + + if (setfscreatecon(argv[1]) < 0) + printf("Error: set\n"); + else printf("Success: set\n"); + + if (getfscreatecon(&con) < 0) + printf("Error: get\n"); + else printf("Success: get\n"); + + printf("create_con = %s\n", con); + + return 0; +} diff --git a/test/Runtime/POSIX/SELinux/lit.local.cfg b/test/Runtime/POSIX/SELinux/lit.local.cfg new file mode 100644 index 00000000..2046d4d0 --- /dev/null +++ b/test/Runtime/POSIX/SELinux/lit.local.cfg @@ -0,0 +1,7 @@ +def getRoot(config): + if not config.parent: + return config + return getRoot(config.parent) + +if not getRoot(config).have_selinux: + config.unsupported = True -- cgit 1.4.1