pts/seccomp: move to NATIVE_TEST

I was using audio tests as an example, but seccomp is much
simpler. Instead, use brillo_Gtests as the test-runner, and move
seccomp_bpf_test to /data/nativetest instead.

Additionally, clean up Clang warnings.

Bug: 24619824

Change-Id: Id7ba4eb5c44ece22afa926c928470fa2f0557db4
Signed-off-by: Kees Cook <keescook@google.com>
diff --git a/pts/seccomp/Android.mk b/pts/seccomp/Android.mk
index 7ce579f..d0e634e 100644
--- a/pts/seccomp/Android.mk
+++ b/pts/seccomp/Android.mk
@@ -22,7 +22,8 @@
 LOCAL_CFLAGS += \
 	-Wno-sign-compare \
 	-Wno-unused-parameter \
-	-Wno-missing-field-initializers
+	-Wno-missing-field-initializers \
+	-Wno-empty-body
 
 # Include this in Brillo -eng builds only (for automated testing).
 ifdef BRILLO
@@ -31,4 +32,4 @@
 
 LOCAL_SRC_FILES := seccomp_bpf.c
 
-include $(BUILD_EXECUTABLE)
+include $(BUILD_NATIVE_TEST)
diff --git a/pts/seccomp/seccomp_bpf.c b/pts/seccomp/seccomp_bpf.c
index c210e22..4a10d1a 100644
--- a/pts/seccomp/seccomp_bpf.c
+++ b/pts/seccomp/seccomp_bpf.c
@@ -1969,7 +1969,7 @@
 	EXPECT_EQ(SIBLING_EXIT_UNKILLED, (long)status);
 	/* Poll for actual task death. pthread_join doesn't guarantee it. */
 	while (!kill(self->sibling[sib].system_tid, 0))
-		sleep(0.1);
+		usleep(100000);
 	/* Switch to the remaining sibling */
 	sib = !sib;
 
@@ -1994,7 +1994,7 @@
 	EXPECT_EQ(0, (long)status);
 	/* Poll for actual task death. pthread_join doesn't guarantee it. */
 	while (!kill(self->sibling[sib].system_tid, 0))
-		sleep(0.1);
+		usleep(100000);
 
 	ret = seccomp(SECCOMP_SET_MODE_FILTER, SECCOMP_FLAG_FILTER_TSYNC,
 		      &self->apply_prog);
diff --git a/pts/seccomp/test_harness.h b/pts/seccomp/test_harness.h
index a786c69..4aa7814 100644
--- a/pts/seccomp/test_harness.h
+++ b/pts/seccomp/test_harness.h
@@ -219,8 +219,9 @@
 #define __TEST_IMPL(test_name, _signal) \
 	static void test_name(struct __test_metadata *_metadata); \
 	static struct __test_metadata _##test_name##_object = \
-		{ name: "global." #test_name, \
-		  fn: &test_name, termsig: _signal }; \
+		{ .name = "global." #test_name, \
+		  .fn = &test_name, \
+		  .termsig = _signal }; \
 	static void __attribute__((constructor)) _register_##test_name(void) \
 	{ \
 		__register_test(&_##test_name##_object); \
@@ -281,9 +282,9 @@
 	} \
 	static struct __test_metadata \
 		      _##fixture_name##_##test_name##_object = { \
-		name: #fixture_name "." #test_name, \
-		fn: &wrapper_##fixture_name##_##test_name, \
-		termsig: signal, \
+		.name = #fixture_name "." #test_name, \
+		.fn = &wrapper_##fixture_name##_##test_name, \
+		.termsig = signal, \
 	 }; \
 	static void __attribute__((constructor)) \
 			_register_##fixture_name##_##test_name(void) \