瀏覽代碼

Disable core dumps for tests which are supposed to crash

Samuel Thibault 8 年之前
父節點
當前提交
9ade595f96
共有 5 個文件被更改,包括 18 次插入0 次删除
  1. 1 0
      configure.ac
  2. 2 0
      mpi/tests/policy_register_toomany.c
  3. 2 0
      mpi/tests/policy_unregister.c
  4. 3 0
      mpi/tests/starpu_redefine.c
  5. 10 0
      tests/helper.h

+ 1 - 0
configure.ac

@@ -635,6 +635,7 @@ fi
 AC_SEARCH_LIBS([sqrt],[m],,AC_MSG_ERROR([math library unavailable]))
 AC_HAVE_LIBRARY([ws2_32])
 AC_CHECK_FUNCS([sysconf])
+AC_CHECK_FUNCS([getrlimit])
 
 AC_CHECK_FUNC([pthread_spin_lock], have_pthread_spin_lock=yes, have_pthread_spin_lock=no)
 if test x$have_pthread_spin_lock = xyes; then

+ 2 - 0
mpi/tests/policy_register_toomany.c

@@ -32,6 +32,8 @@ int main(int argc, char **argv)
 	int ret;
 	int i;
 
+	disable_coredump();
+
 	ret = starpu_init(NULL);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 	ret = starpu_mpi_init(&argc, &argv, 1);

+ 2 - 0
mpi/tests/policy_unregister.c

@@ -21,6 +21,8 @@ int main(int argc, char **argv)
 {
 	int ret;
 
+	disable_coredump();
+
 	ret = starpu_init(NULL);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 	ret = starpu_mpi_init(&argc, &argv, 1);

+ 3 - 0
mpi/tests/starpu_redefine.c

@@ -15,12 +15,15 @@
  */
 
 #include <starpu_mpi.h>
+#include "helper.h"
 
 int main(int argc, char **argv)
 {
 	int ret;
 	starpu_data_handle_t handle;
 
+	disable_coredump();
+
 	MPI_Init(&argc, &argv);
 	ret = starpu_init(NULL);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");

+ 10 - 0
tests/helper.h

@@ -18,6 +18,9 @@
 #define _TESTS_HELPER_H
 #include <errno.h>
 #include <common/utils.h>
+#ifdef HAVE_GETRLIMIT
+#include <sys/resource.h>
+#endif
 
 #ifdef STARPU_HAVE_VALGRIND_H
 #include <valgrind/valgrind.h>
@@ -103,4 +106,11 @@ static int _starpu_valgrind_print_once STARPU_ATTRIBUTE_UNUSED = 0;
 #define ANNOTATE_HAPPENS_AFTER(obj) ((void)0)
 #endif
 
+static inline void disable_coredump(void) {
+#ifdef HAVE_GETRLIMIT
+	struct rlimit rlim = { .rlim_cur = 0, .rlim_max = 0 };
+	setrlimit(RLIMIT_CORE, &rlim);
+#endif
+}
+
 #endif /* _TESTS_HELPER_H */