socsvn commit: r337248 - soc2018/aniketp/head/tests/sys/audit

aniketp at FreeBSD.org aniketp at FreeBSD.org
Thu May 24 12:07:09 UTC 2018


Author: aniketp
Date: Thu May 24 12:07:06 2018
New Revision: 337248
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=337248

Log:
  Improvements in test-case semantics (exec) audit_class
  

Modified:
  soc2018/aniketp/head/tests/sys/audit/exec.c

Modified: soc2018/aniketp/head/tests/sys/audit/exec.c
==============================================================================
--- soc2018/aniketp/head/tests/sys/audit/exec.c	Thu May 24 11:58:32 2018	(r337247)
+++ soc2018/aniketp/head/tests/sys/audit/exec.c	Thu May 24 12:07:06 2018	(r337248)
@@ -38,7 +38,9 @@
 static pid_t pid;
 static int status;
 static struct pollfd fds[1];
+static char bin[] = "/usr/bin/true";
 static char argument[] = "sample-argument";
+static char *arg[] = {bin, argument, NULL};
 
 
 ATF_TC_WITH_CLEANUP(execve_success);
@@ -50,10 +52,7 @@
 
 ATF_TC_BODY(execve_success, tc)
 {
-	char bin[] = "/usr/bin/true";
-
-	const char *regex = "execve.*sample-argument";
-	char *arg[] = {bin, argument, NULL};
+	const char *regex = "execve.*sample-argument.*Unknown error: 201";
 	FILE *pipefd = setup(fds, "ex");
 
 	ATF_REQUIRE((pid = fork()) != -1);
@@ -61,9 +60,8 @@
 		ATF_REQUIRE(wait(&status) != -1);
 		check_audit(fds, regex, pipefd);
 	}
-	else {
+	else
 		ATF_REQUIRE(execve(bin, arg, NULL) != -1);
-	}
 }
 
 ATF_TC_CLEANUP(execve_success, tc)
@@ -81,9 +79,7 @@
 
 ATF_TC_BODY(execve_failure, tc)
 {
-	char bin[] = "/does/not/exist";
-	const char *regex = "execve.*sample-argument.*return,failure";
-	char *arg[] = {bin, argument, NULL};
+	const char *regex = "execve.*return,failure : Bad address";
 	FILE *pipefd = setup(fds, "ex");
 
 	ATF_REQUIRE((pid = fork()) != -1);
@@ -91,9 +87,8 @@
 		ATF_REQUIRE(wait(&status) != -1);
 		check_audit(fds, regex, pipefd);
 	}
-	else {
-		ATF_REQUIRE_EQ(-1, execve(bin, arg, NULL));
-	}
+	else
+		ATF_REQUIRE_EQ(-1, execve(bin, arg, (char *const *)(-1)));
 }
 
 ATF_TC_CLEANUP(execve_failure, tc)


More information about the svn-soc-all mailing list