Browse Source

testsam: Try to turn off coredump

Also stdout line buffering.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 6 months ago
parent
commit
622b2cea62
1 changed files with 15 additions and 3 deletions
  1. 15 3
      test/testsam.c

+ 15 - 3
test/testsam.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2011 Red Hat, Inc.
+ * Copyright (c) 2009-2025 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -38,9 +38,11 @@
 
 #include <config.h>
 
+#include <sys/types.h>
+#include <sys/resource.h>
+
 #include <limits.h>
 #include <pthread.h>
-#include <sys/types.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -238,12 +240,20 @@ static int test2 (void) {
 }
 
 /*
- * Smoke test. Better to turn off coredump ;) This has no time limit, just restart process
+ * Smoke test. This has no time limit, just restart process
  * when it dies.
  */
 static int test3 (void) {
 	cs_error_t error;
 	unsigned int instance_id;
+	struct rlimit lim;
+
+	lim.rlim_cur = lim.rlim_max = 0;
+
+	/*
+	 * Try to turn off core creation
+	 */
+	setrlimit(RLIMIT_CORE, &lim);
 
 	printf ("%s: initialize\n", __FUNCTION__);
 	error = sam_initialize (0, SAM_RECOVERY_POLICY_RESTART);
@@ -1239,6 +1249,8 @@ int main(int argc, char *argv[])
 	int all_passed = 1;
 	int no_skipped = 0;
 
+	setlinebuf(stdout);
+
 	pid = fork ();
 
 	if (pid == -1) {