From: Avery Pennarun Date: Fri, 1 May 2009 01:49:23 +0000 (-0400) Subject: Fix standalone compilation of wvtest/cpp. X-Git-Url: http://rtime.felk.cvut.cz/gitweb/wvtest.git/commitdiff_plain/7712d67409af5e62d4fda1e2e18bb333e98502f2 Fix standalone compilation of wvtest/cpp. --- diff --git a/Makefile b/Makefile index 3755d3c..6d238d2 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,12 @@ all: runtests: make -C python runtests make -C dotnet runtests + make -C cpp runtests test: ./wvtestrunner.pl $(MAKE) runtests + +clean:: + make -C python clean + make -C dotnet clean + make -C cpp clean diff --git a/cpp/Makefile b/cpp/Makefile new file mode 100644 index 0000000..5d8b6a8 --- /dev/null +++ b/cpp/Makefile @@ -0,0 +1,16 @@ + +all: + @echo "Try: make test" + @false + +t/wvtest: wvtestmain.cc wvtest.cc t/wvtest.t.cc + g++ -D WVTEST_CONFIGURED -o $@ -I. $^ + +runtests: t/wvtest + t/wvtest + +test: + ../wvtestrunner.pl $(MAKE) runtests + +clean:: + rm -f *~ *.o t/*.o t/wvtest diff --git a/cpp/t/.gitignore b/cpp/t/.gitignore new file mode 100644 index 0000000..160e518 --- /dev/null +++ b/cpp/t/.gitignore @@ -0,0 +1 @@ +wvtest diff --git a/cpp/t/wvtest.t.cc b/cpp/t/wvtest.t.cc new file mode 100644 index 0000000..d445c06 --- /dev/null +++ b/cpp/t/wvtest.t.cc @@ -0,0 +1,10 @@ +#include "wvtest.h" + +WVTEST_MAIN("wvtest tests") +{ + WVPASS(1); + WVPASSEQ(1, 1); + WVPASSNE(1, 2); + WVPASSEQ(1, 1); + WVPASSLT(1, 2); +} diff --git a/cpp/wvtest.cc b/cpp/wvtest.cc index 809d1ec..5cb1d21 100644 --- a/cpp/wvtest.cc +++ b/cpp/wvtest.cc @@ -5,7 +5,6 @@ * Part of an automated testing framework. See wvtest.h. */ #include "wvtest.h" -#include "wvautoconf.h" #include #include #include diff --git a/cpp/wvtest.h b/cpp/wvtest.h index 69015d3..3fc64f3 100644 --- a/cpp/wvtest.h +++ b/cpp/wvtest.h @@ -12,6 +12,10 @@ #ifndef __WVTEST_H #define __WVTEST_H +#ifndef WVTEST_CONFIGURED +# error "Missing settings: HAVE_VALGRIND_MEMCHECK_H HAVE_WVCRASH WVTEST_CONFIGURED" +#endif + #include class WvTest @@ -58,6 +62,8 @@ public: WvTest::start_check(__FILE__, __LINE__, "NOT(" #cond ")", !(cond)) #define WVFAILEQ(a, b) \ WvTest::start_check_eq(__FILE__, __LINE__, (a), (b), false) +#define WVPASSNE(a, b) WVFAILEQ(a, b) +#define WVFAILNE(a, b) WVPASSEQ(a, b) #define WVTEST_MAIN3(descr, ff, ll, slowness) \ static void _wvtest_main_##ll(); \ diff --git a/cpp/wvtestmain.cc b/cpp/wvtestmain.cc index 9f18ac3..c675289 100644 --- a/cpp/wvtestmain.cc +++ b/cpp/wvtestmain.cc @@ -1,6 +1,7 @@ #include "wvtest.h" -#include "wvcrash.h" -#include "wvstring.h" +#ifdef HAVE_WVCRASH +# include "wvcrash.h" +#endif #include #include #ifdef _WIN32 @@ -50,7 +51,8 @@ static int fd_count(const char *when) int main(int argc, char **argv) { -#ifdef _WIN32 + char buf[200]; +#if defined(_WIN32) && defined(HAVE_WVCRASH) setup_console_crash(); #endif @@ -76,7 +78,10 @@ int main(int argc, char **argv) WVPASS(startfd == endfd); #ifndef _WIN32 if (startfd != endfd) - system(WvString("ls -l /proc/%s/fd", getpid())); + { + sprintf(buf, "ls -l /proc/%d/fd", getpid()); + system(buf); + } #endif } diff --git a/python/Makefile b/python/Makefile index d12f1dd..46750bf 100644 --- a/python/Makefile +++ b/python/Makefile @@ -9,3 +9,6 @@ runtests: test: ../wvtestrunner.pl $(MAKE) runtests + +clean:: + rm -f *~ t/*~ *.pyc t/*.pyc \ No newline at end of file