aboutsummaryrefslogtreecommitdiff
path: root/libasm_test.h
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-11-07 17:20:22 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-11-07 17:20:22 +0100
commit1695b0184d3a671a7dfae8061709197c9cab8347 (patch)
tree73acba82d3654154756ae874a879e386de198ec0 /libasm_test.h
parentada41e81dc2d0c01610767837d996f3cc004e008 (diff)
downloadlibasm_test-1695b0184d3a671a7dfae8061709197c9cab8347.tar.gz
libasm_test-1695b0184d3a671a7dfae8061709197c9cab8347.tar.bz2
libasm_test-1695b0184d3a671a7dfae8061709197c9cab8347.zip
Added signaled_suite global to avoid test segfault
Diffstat (limited to 'libasm_test.h')
-rw-r--r--libasm_test.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/libasm_test.h b/libasm_test.h
index 82b675a..afbc959 100644
--- a/libasm_test.h
+++ b/libasm_test.h
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/08 03:07:19 by cacharle #+# #+# */
-/* Updated: 2020/10/21 15:37:33 by charles ### ########.fr */
+/* Updated: 2020/11/07 17:13:23 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -109,17 +109,19 @@ void ref_ft_list_remove_if(t_list **begin_list, void *data_ref,
*/
extern int pid;
extern bool signaled;
-
-# define TEST_SEGFAULT(x) do { \
- if ((pid = fork()) < 0) \
- exit(EXIT_FAILURE); \
- if (pid == 0) { \
- do { x; } while(0); \
- exit(EXIT_SUCCESS); \
- } else { \
- wait(&pid); \
- signaled = WIFSIGNALED(pid); \
- } \
+extern bool signaled_suite;
+
+# define TEST_SEGFAULT(x) do { \
+ if ((pid = fork()) < 0) \
+ exit(EXIT_FAILURE); \
+ if (pid == 0) { \
+ do { x; } while(0); \
+ exit(EXIT_SUCCESS); \
+ } else { \
+ wait(&pid); \
+ signaled = WIFSIGNALED(pid); \
+ if (signaled) signaled_suite = true; \
+ } \
} while(0)
extern char *test_name;