create new make target test_standalone

This commit is contained in:
Steffen Jaeckel 2015-02-15 15:13:20 +01:00
parent d02974e02f
commit e4f59d4d61
4 changed files with 28 additions and 5 deletions

View File

@ -3,6 +3,11 @@
#include <time.h>
#include <unistd.h>
#ifndef TFM_DEMO_TEST_VS_MTEST
#define TFM_DEMO_TEST_VS_MTEST 1
#endif
void draw(fp_int *a)
{
int x;
@ -30,9 +35,11 @@ int myrng(unsigned char *dst, int len, void *dat)
int main(void)
{
fp_int a,b,c,d,e,f;
unsigned long ix;
#if TFM_DEMO_TEST_VS_MTEST
unsigned long expt_n, add_n, sub_n, mul_n, div_n, sqr_n, mul2d_n, div2d_n, gcd_n, lcm_n, inv_n,
div2_n, mul2_n, add_d_n, sub_d_n, mul_d_n, cnt, rr, ix;
#ifndef TESTING
div2_n, mul2_n, add_d_n, sub_d_n, mul_d_n, cnt, rr;
#else
fp_digit fp;
int n, err;
#endif
@ -42,7 +49,7 @@ int main(void)
fp_zero(&b); fp_zero(&c); fp_zero(&d); fp_zero(&e); fp_zero(&f);
fp_zero(&a);
#ifndef TESTING
#if TFM_DEMO_TEST_VS_MTEST == 0
draw(&a);
@ -179,7 +186,8 @@ int main(void)
printf("\n\n");
return 0;
#endif
#else
fp_zero(&b); fp_zero(&c); fp_zero(&d); fp_zero(&e); fp_zero(&f); fp_zero(&a);
@ -422,6 +430,7 @@ draw(&a);draw(&b);draw(&c);draw(&d);
}
}
#endif
}

View File

@ -111,6 +111,12 @@ demo/test.o: CFLAGS+=-Wno-unused-result
test: $(LIBNAME) demo/test.o
$(CC) $(CFLAGS) demo/test.o $(LIBNAME) $(PROF) -o test
test_standalone: CFLAGS+=-DTFM_DEMO_TEST_VS_MTEST=0
.PHONY: test_standalone
test_standalone: $(LIBNAME) demo/test.o
$(CC) $(CFLAGS) demo/test.o $(LIBNAME) $(PROF) -o test
timing: $(LIBNAME) demo/timing.o
$(CC) $(CFLAGS) demo/timing.o $(LIBNAME) $(PROF) -o timing

View File

@ -98,10 +98,18 @@ install: $(LIBNAME)
mtest/mtest: mtest/mtest.c
cd mtest ; make mtest
demo/test.o: CFLAGS+=-Wno-unused-result
.PHONY: test
test: $(LIBNAME) demo/test.o
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o test demo/test.o $(LIBNAME)
test_standalone: CFLAGS+=-DTFM_DEMO_TEST_VS_MTEST=0
.PHONY: test_standalone
test_standalone: $(LIBNAME) demo/test.o
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o test demo/test.o $(LIBNAME)
stest: $(LIBNAME) demo/stest.o
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o stest demo/stest.o $(LIBNAME)

View File

@ -7,7 +7,7 @@ _runtest()
echo -n "Run test $1 $2"
trap 'echo " - build not successful, errors are:" && cat test_gcc_errors.txt' INT TERM
make clean > /dev/null
CC="${1}" make test -j9 $2 > /dev/null 2>test_gcc_errors.txt
CC="${1}" make test_standalone -j9 $2 > /dev/null 2>test_gcc_errors.txt
trap - INT TERM
local outfile="test_$(echo ${1}${2} | tr -d '\"' | tr ' ' '_').txt"
trap 'echo " - tests not successful, failed at:" && tail ${outfile}' INT TERM