Add test for testing expected failures

This commit is contained in:
Patrick Pelissier committed 2020-05-09 10:56:31 +02:00
1 parent 34f70a031f
commit 4426a60904
2 files changed
+61 -1

No files matched your search

+13 -1
View File
@@ -63,7 +63,7 @@ depend:
# Clean
#####################################################################################################
check: depend
check: depend checkfail
$(MAKE) `ls test-*.c|$(SED) 's/\.c/\.log/g'`
clean:
@@ -74,6 +74,18 @@ clean:
distclean: clean
$(RM) *.depend depend
checkfail: fail-no-oplist
#####################################################################################################
# Proper failure generation (test if the code properly fails to compile)
#####################################################################################################
# TODO: should grep failure message?
fail-no-oplist:
for i in 1 2 3 4 5 6 ; do \
if $(CC) $(CFLAGS) $(CPPFLAGS) -g -c fail-no-oplist.c -o tmp.o -DTEST=$$i 2> fail-no-oplist-$$i.log ; then echo FAILURE: fail-no-oplist-$$i ; false; else echo OK: fail-no-oplist-$$i ; fi \
done
#####################################################################################################
# Code generation analysis
+48
View File
@@ -0,0 +1,48 @@
#include "m-core.h"
#if !defined(TEST)
# warning Please define TEST variable to select the test to run
#elif TEST == 1
/* Test of the call to no default function */
#define OP (INIT(init))
void f(int x, int y) {
M_CALL_SWAP(OP, x, y);
}
#elif TEST == 2
void f(int x, int y) {
M_CALL_SET(M_VALID_OPLIST(DEFAULT_OPLIST), x, y);
}
#elif TEST == 3
#include "m-array.h"
ARRAY_DEF(array, int, DEFAULT_OPLIST)
#elif TEST == 4
#include "m-list.h"
LIST_DEF(list, int, DEFAULT_OPLIST)
#elif TEST == 5
#include "m-deque.h"
DEQUE_DEF(deque, int, DEFAULT_OPLIST)
#elif TEST == 6
#include "m-i-list.h"
typedef struct tmp_str_s {
ILIST_INTERFACE(tmpstr, struct tmp_str_s);
int n;
} tmp_str_t;
ILIST_DEF(tmpstr, tmp_str_t, DEFAULT_OPLIST)
#else
# warning TEST variable is out of range.
#endif