Skip to contentSkip to conversation

smokey/sigdebug: check kernel features with corectl

PATCH Applied Henning Schild 2 participants 2 messages May 12, 2017 – May 14, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smokey/sigdebug: check kernel features with corectl

One of the subtests depends on a kernel feature, skip it if the feature was not enabled.

---
 testsuite/smokey/sigdebug/sigdebug.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
testsuite/smokey/sigdebug/sigdebug.c +15 -4
index a643305..87f0be6 100644
@@ -33,6 +33,7 @@ smokey_test_plugin(sigdebug,
 unsigned int expected_reason;
 bool sigdebug_received;
 pthread_mutex_t prio_invert;
+int corectl_debug;
 sem_t send_signal;
 char *mem;
 FILE *wd;
@@ -110,10 +111,15 @@ static void *rt_thread_body(void *cookie)
 	check_sigdebug_received("SIGDEBUG_MIGRATE_SIGNAL");
 
 	smokey_trace("relaxed mutex owner");
-	setup_checkdebug(SIGDEBUG_MIGRATE_PRIOINV);
-	err = pthread_mutex_lock(&prio_invert);
-	check_no_error("pthread_mutex_lock", err);
-	check_sigdebug_received("SIGDEBUG_MIGRATE_PRIOINV");
+	if (corectl_debug & _CC_COBALT_DEBUG_MUTEX_RELAXED) {
+		setup_checkdebug(SIGDEBUG_MIGRATE_PRIOINV);
+		err = pthread_mutex_lock(&prio_invert);
+		check_no_error("pthread_mutex_lock", err);
+		check_sigdebug_received("SIGDEBUG_MIGRATE_PRIOINV");
+	} else {
+		smokey_note("sigdebug \"SIGDEBUG_MIGRATE_PRIOINV\" skipped "
+			    "(no kernel support)");
+	}
 
 	smokey_trace("page fault");
 	setup_checkdebug(SIGDEBUG_MIGRATE_FAULT);
@@ -189,6 +195,11 @@ static int run_sigdebug(struct smokey_test *t, int argc, char *const argv[])
 	if (err || wdog_delay == 0)
 		return -ENOSYS;
 
+	err = cobalt_corectl(_CC_COBALT_GET_DEBUG, &corectl_debug,
+			     sizeof(corectl_debug));
+	if (err)
+		return -ENOSYS;
+
 	smokey_parse_args(t, argc, argv);
 	if (!SMOKEY_ARG_ISSET(sigdebug, no_watchdog) ||
 	    !SMOKEY_ARG_BOOL(sigdebug, no_watchdog)) {
Signature · 1 line
2.10.2
#1 lore raw
Quoted 2 lines · Henning Schild

One of the subtests depends on a kernel feature, skip it if the feature was not enabled.

Merged, thanks.

Signature · 1 line
Philippe.