Skip to content

Commit 99a91df

Browse files
committed
Tests moved to testsuites/ directory.
1 parent 000ddfb commit 99a91df

File tree

7 files changed

+47
-31
lines changed

7 files changed

+47
-31
lines changed

Makefile

+4-28
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ endif
1717

1818
TARGETS = libcu.a
1919

20-
TEST_OBJS = test.o test2.o
21-
2220
all: $(TARGETS)
2321

2422
libcu.a: cu.o
@@ -28,28 +26,6 @@ libcu.a: cu.o
2826
cu.o: cu.c cu.h
2927
$(CC) $(CFLAGS) -c -o $@ $<
3028

31-
test: $(TEST_OBJS) libcu.a
32-
$(CC) $(CFLAGS) -o $@ $(TEST_OBJS) -L./ -lcu
33-
test-segfault: test-segfault.c libcu.a
34-
$(CC) $(CFLAGS) -o $@ $^ -L./ -lcu
35-
36-
check: test test-segfault
37-
mkdir -p regressions
38-
touch regressions/testSuiteName.out
39-
touch regressions/testSuiteName.err
40-
touch regressions/testSuiteName2.out
41-
touch regressions/testSuiteName2.err
42-
touch regressions/testSuiteSegfault.out
43-
touch regressions/testSuiteSegfault.err
44-
touch regressions/testSuiteTest2.out
45-
touch regressions/testSuiteTest2.err
46-
-./test
47-
-cd regressions && $(PYTHON) ../cu-check-regressions
48-
@echo ""
49-
@echo "======= SEGFAULT: ========="
50-
@echo ""
51-
-./test-segfault
52-
5329
install: libcu.a
5430
mkdir -p $(PREFIX)/$(INCLUDEDIR)
5531
mkdir -p $(PREFIX)/$(LIBDIR)
@@ -65,10 +41,10 @@ deb:
6541

6642
clean:
6743
rm -f *.o
68-
rm -f test
69-
rm -f test-segfault
7044
rm -f $(TARGETS)
71-
rm -f tmp.*
72-
rm -rf regressions
45+
$(MAKE) -C testsuites clean
46+
47+
check:
48+
$(MAKE) -C testsuites
7349

7450
.PHONY: all clean check

testsuites/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test
2+
test-segfault
3+
regressions/

testsuites/Makefile

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
CC ?= gcc
2+
PYTHON ?= python
3+
4+
TEST_OBJS = test.o test2.o
5+
6+
all: test test-segfault
7+
mkdir -p regressions
8+
touch regressions/testSuiteName.out
9+
touch regressions/testSuiteName.err
10+
touch regressions/testSuiteName2.out
11+
touch regressions/testSuiteName2.err
12+
touch regressions/testSuiteSegfault.out
13+
touch regressions/testSuiteSegfault.err
14+
touch regressions/testSuiteTest2.out
15+
touch regressions/testSuiteTest2.err
16+
-./test
17+
-cd regressions && $(PYTHON) ../../cu-check-regressions
18+
@echo ""
19+
@echo "======= SEGFAULT: ========="
20+
@echo ""
21+
-./test-segfault
22+
23+
test: $(TEST_OBJS)
24+
$(CC) $(CFLAGS) -o $@ $(TEST_OBJS) -L../ -lcu
25+
26+
test-segfault: test-segfault.c
27+
$(CC) $(CFLAGS) -o $@ $^ -L../ -lcu
28+
29+
clean:
30+
rm -f *.o
31+
rm -f test
32+
rm -f test-segfault
33+
rm -f tmp.*
34+
rm -rf regressions
35+
36+
37+
.PHONY: all clean

test-segfault.c testsuites/test-segfault.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <stdio.h>
2-
#include "cu.h"
2+
#include "../cu.h"
33

44
/**
55
* Definition of test function

test.c testsuites/test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <stdio.h>
2-
#include "cu.h"
2+
#include "../cu.h"
33

44
/**
55
* Test suite from imported from other file.

test2.c testsuites/test2.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <stdio.h>
2-
#include "cu.h"
2+
#include "../cu.h"
33

44
TEST(testTest2Function)
55
{

test2.h testsuites/test2.h

File renamed without changes.

0 commit comments

Comments
 (0)