summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2012-06-16 15:22:13 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2012-06-16 15:22:13 +0000
commit00e24b43ffc8cc0eb2f062218646f465a8176b8f (patch)
tree7de3b00ff9a283fdde5c1ad04aee3a882a8d7fff
parentc53d22c90235600c9518eccc63d2dd1416320044 (diff)
Include testing/regtest.cc in Makefile.am
-rw-r--r--xdelta3/Makefile.am23
-rwxr-xr-xxdelta3/testing/Makefile.orig (renamed from xdelta3/testing/Makefile)0
-rw-r--r--xdelta3/testing/modify.h28
-rw-r--r--xdelta3/testing/regtest.cc27
-rw-r--r--xdelta3/testing/regtest_c.c2
-rw-r--r--xdelta3/xdelta3-internal.h4
6 files changed, 48 insertions, 36 deletions
diff --git a/xdelta3/Makefile.am b/xdelta3/Makefile.am
index e3dfbab..749ed47 100644
--- a/xdelta3/Makefile.am
+++ b/xdelta3/Makefile.am
@@ -1,5 +1,5 @@
1bin_PROGRAMS = xdelta3 1bin_PROGRAMS = xdelta3 xdelta3regtest
2xdelta3_SOURCES = \ 2common_SOURCES = \
3 xdelta3-blkcache.h \ 3 xdelta3-blkcache.h \
4 xdelta3-cfgs.h \ 4 xdelta3-cfgs.h \
5 xdelta3-decode.h \ 5 xdelta3-decode.h \
@@ -12,18 +12,23 @@ xdelta3_SOURCES = \
12 xdelta3-python.h \ 12 xdelta3-python.h \
13 xdelta3-second.h \ 13 xdelta3-second.h \
14 xdelta3-test.h \ 14 xdelta3-test.h \
15 xdelta3.c \
16 xdelta3.h 15 xdelta3.h
17 16
17xdelta3_SOURCES = $(common_SOURCES) xdelta3.c
18xdelta3regtest_SOURCES = $(common_SOURCES) testing/regtest_c.c testing/regtest.cc
19
18WFLAGS = -Wall -Wshadow -fno-builtin -Wextra -Wsign-compare \ 20WFLAGS = -Wall -Wshadow -fno-builtin -Wextra -Wsign-compare \
19 -Wextra -Wno-unused-parameter 21 -Wextra -Wno-unused-parameter
20# -Wconversion 22common_CFLAGS = $(WFLAGS) \
21xdelta3_CFLAGS = $(WFLAGS) \
22 -DGENERIC_ENCODE_TABLES=0 \ 23 -DGENERIC_ENCODE_TABLES=0 \
23 -DREGRESSION_TEST=1 \ 24 -DREGRESSION_TEST=1 \
24 -DSECONDARY_DJW=1 \ 25 -DSECONDARY_DJW=1 \
25 -DSECONDARY_FGK=1 \ 26 -DSECONDARY_FGK=1 \
26 -DXD3_DEBUG=0 \
27 -DXD3_MAIN=1 \
28 -DXD3_POSIX=1 \ 27 -DXD3_POSIX=1 \
29 -DXD3_USE_LARGEFILE64=1 28 -DXD3_USE_LARGEFILE64=1 \
29 -DXD3_MAIN=1
30
31xdelta3_CFLAGS = $(common_CFLAGS)
32
33xdelta3regtest_CXXFLAGS = $(common_CFLAGS) -DNOT_MAIN=1 -DXD3_DEBUG=1
34xdelta3regtest_CFLAGS = $(common_CFLAGS) -DNOT_MAIN=1 -DXD3_DEBUG=1
diff --git a/xdelta3/testing/Makefile b/xdelta3/testing/Makefile.orig
index 61295f2..61295f2 100755
--- a/xdelta3/testing/Makefile
+++ b/xdelta3/testing/Makefile.orig
diff --git a/xdelta3/testing/modify.h b/xdelta3/testing/modify.h
index 4a6edd3..ca83c21 100644
--- a/xdelta3/testing/modify.h
+++ b/xdelta3/testing/modify.h
@@ -22,31 +22,31 @@ public:
22 }; 22 };
23 23
24 // Constructor for modify, add, delete. 24 // Constructor for modify, add, delete.
25 Change(Kind kind, xoff_t size, xoff_t addr1) 25 Change(Kind kind0, xoff_t size0, xoff_t addr1_0)
26 : kind(kind), 26 : kind(kind0),
27 size(size), 27 size(size0),
28 addr1(addr1), 28 addr1(addr1_0),
29 addr2(0), 29 addr2(0),
30 insert(NULL) { 30 insert(NULL) {
31 CHECK(kind != MOVE && kind != COPY && kind != OVERWRITE); 31 CHECK(kind != MOVE && kind != COPY && kind != OVERWRITE);
32 } 32 }
33 33
34 // Constructor for modify, add w/ provided data. 34 // Constructor for modify, add w/ provided data.
35 Change(Kind kind, xoff_t size, xoff_t addr1, Segment *insert) 35 Change(Kind kind0, xoff_t size0, xoff_t addr1_0, Segment *insert0)
36 : kind(kind), 36 : kind(kind0),
37 size(size), 37 size(size0),
38 addr1(addr1), 38 addr1(addr1_0),
39 addr2(0), 39 addr2(0),
40 insert(insert) { 40 insert(insert0) {
41 CHECK(kind != MOVE && kind != COPY && kind != OVERWRITE); 41 CHECK(kind != MOVE && kind != COPY && kind != OVERWRITE);
42 } 42 }
43 43
44 // Constructor for move, copy, overwrite 44 // Constructor for move, copy, overwrite
45 Change(Kind kind, xoff_t size, xoff_t addr1, xoff_t addr2) 45 Change(Kind kind0, xoff_t size0, xoff_t addr1_0, xoff_t addr2_0)
46 : kind(kind), 46 : kind(kind0),
47 size(size), 47 size(size0),
48 addr1(addr1), 48 addr1(addr1_0),
49 addr2(addr2), 49 addr2(addr2_0),
50 insert(NULL) { 50 insert(NULL) {
51 CHECK(kind == MOVE || kind == COPY || kind == OVERWRITE); 51 CHECK(kind == MOVE || kind == COPY || kind == OVERWRITE);
52 } 52 }
diff --git a/xdelta3/testing/regtest.cc b/xdelta3/testing/regtest.cc
index 65d8d34..be6309a 100644
--- a/xdelta3/testing/regtest.cc
+++ b/xdelta3/testing/regtest.cc
@@ -848,28 +848,29 @@ void MainTest() {
848 TEST(TestEmptyInMemory); 848 TEST(TestEmptyInMemory);
849 TEST(TestBlockInMemory); 849 TEST(TestBlockInMemory);
850 TEST(TestNonBlockingProgress); 850 TEST(TestNonBlockingProgress);
851#if 0
852 TEST(TestFifoCopyDiscipline); 851 TEST(TestFifoCopyDiscipline);
853 TEST(TestMergeCommand1); 852 TEST(TestMergeCommand1);
854 TEST(TestMergeCommand2); 853 TEST(TestMergeCommand2);
855#endif
856} 854}
857 855
858#undef TEST 856#undef TEST
859 857
860#ifdef HACK
861#define NOT_MAIN 1
862#define XD3_MAIN 1
863#define XD3_POSIX 1
864#include "../xdelta3.c"
865
866int main(int argc, char **argv) 858int main(int argc, char **argv)
867#else
868// Run the unittests, followed by xdelta tests for various constants.
869extern "C" int xd3_regtest_main(int argc, char **argv);
870extern "C" int xd3_regtest_main(int argc, char **argv)
871#endif
872{ 859{
860 vector<const char*> mcmd;
861 string pn;
862 const char *sp = strrchr(argv[0], '/');
863 if (sp != NULL) {
864 pn.append(argv[0], sp - argv[0] + 1);
865 }
866 pn.append("xdelta3");
867 mcmd.push_back(pn.c_str());
868 mcmd.push_back("test");
869 mcmd.push_back(NULL);
870
871 CHECK_EQ(0, xd3_main_cmdline(mcmd.size() - 1,
872 const_cast<char**>(&mcmd[0])));
873
873 UnitTest<SmallBlock>(); 874 UnitTest<SmallBlock>();
874 MainTest<SmallBlock>(); 875 MainTest<SmallBlock>();
875 MainTest<MixedBlock>(); 876 MainTest<MixedBlock>();
diff --git a/xdelta3/testing/regtest_c.c b/xdelta3/testing/regtest_c.c
new file mode 100644
index 0000000..e2845ee
--- /dev/null
+++ b/xdelta3/testing/regtest_c.c
@@ -0,0 +1,2 @@
1/* -*- Mode: C++ -*- */
2#include "../xdelta3.c"
diff --git a/xdelta3/xdelta3-internal.h b/xdelta3/xdelta3-internal.h
index 47cfe59..d134564 100644
--- a/xdelta3/xdelta3-internal.h
+++ b/xdelta3/xdelta3-internal.h
@@ -15,6 +15,8 @@
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18#ifndef XDELTA3_INTERNAL_H__
19#define XDELTA3_INTERNAL_H__
18 20
19#include <stdio.h> 21#include <stdio.h>
20#include <stdarg.h> 22#include <stdarg.h>
@@ -123,3 +125,5 @@ void xprintf(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
123#define NTR "" 125#define NTR ""
124 126
125#endif 127#endif
128
129#endif // XDELTA3_INTERNAL_H__