diff --git a/.gitignore b/.gitignore index 7896ad1161..a9b9524627 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,9 @@ Makefile autom4te.cache ccache -ccache.exe ccache-*.tar.* ccache.1 +ccache.exe ccache.html ccache.xml config.cache @@ -19,10 +19,10 @@ config.h.in config.log config.status configure -dev_mode_disabled dev.mk +dev_mode_disabled perfdir.* -test/main -test/suites.h testdir.* +unittest/run +unittest/suites.h version.c diff --git a/Makefile.in b/Makefile.in index 3ddabaa06e..7b218c35e0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -10,7 +10,7 @@ sysconfdir = @sysconfdir@ installcmd = @INSTALL@ AR = @AR@ -SH = @SH@ +BASH = @BASH@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ @@ -61,13 +61,14 @@ zlib_sources = \ zlib_objs = $(zlib_sources:.c=.o) test_suites = @test_suites@ -test_sources = test/main.c test/framework.c test/util.c $(test_suites) +test_sources = unittest/main.c unittest/framework.c unittest/util.c +test_sources += $(test_suites) test_objs = $(test_sources:.c=.o) all_sources = $(ccache_sources) $(test_sources) all_objs = $(ccache_objs) $(test_objs) $(zlib_objs) -files_to_clean = $(all_objs) ccache$(EXEEXT) test/main$(EXEEXT) *~ testdir.* +files_to_clean = $(all_objs) ccache$(EXEEXT) unittest/run$(EXEEXT) *~ testdir.* files_to_distclean = Makefile config.h config.log config.status .PHONY: all @@ -100,20 +101,20 @@ perf: ccache$(EXEEXT) $(srcdir)/perf.py --ccache ccache$(EXEEXT) $(CC) $(all_cppflags) $(all_cflags) $(srcdir)/ccache.c .PHONY: test -test: ccache$(EXEEXT) test/main$(EXEEXT) - test/main$(EXEEXT) - CC='$(CC)' $(SH) $(srcdir)/test.sh +test: ccache$(EXEEXT) unittest/run$(EXEEXT) + unittest/run$(EXEEXT) + CC='$(CC)' $(BASH) $(srcdir)/test/run -.PHONY: quicktest -quicktest: test/main$(EXEEXT) - test/main$(EXEEXT) +.PHONY: unittest +unittest: unittest/run$(EXEEXT) + unittest/run$(EXEEXT) -test/main$(EXEEXT): $(base_objs) $(test_objs) $(extra_libs) +unittest/run$(EXEEXT): $(base_objs) $(test_objs) $(extra_libs) $(CC) $(all_cflags) -o $@ $(base_objs) $(test_objs) $(LDFLAGS) $(extra_libs) $(LIBS) -test/main.o: test/suites.h +unittest/main.o: unittest/suites.h -test/suites.h: $(test_suites) Makefile +unittest/suites.h: $(test_suites) Makefile sed -n 's/TEST_SUITE(\(.*\))/SUITE(\1)/p' $(test_suites) >$@ .PHONY: check @@ -124,9 +125,9 @@ distclean: clean rm -rf $(files_to_distclean) .PHONY: installcheck -installcheck: ccache$(EXEEXT) test/main$(EXEEXT) - test/main$(EXEEXT) - CCACHE=$(bindir)/ccache CC='$(CC)' $(SH) $(srcdir)/test.sh +installcheck: ccache$(EXEEXT) unittest/run$(EXEEXT) + unittest/run$(EXEEXT) + CCACHE=$(bindir)/ccache CC='$(CC)' $(BASH) $(srcdir)/test/run .c.o: $(CC) $(all_cppflags) $(all_cflags) -c -o $@ $< diff --git a/configure.ac b/configure.ac index f84d1e0f04..f24e1d6633 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ if test -z "$AR"; then fi # Prefer bash, needed for test.sh -AC_PATH_TOOL(SH, bash, "/bin/sh") +AC_PATH_TOOL(BASH, bash, "/bin/bash") # If GCC, turn on warnings. if test "x$GCC" = "xyes"; then @@ -172,7 +172,7 @@ if test ! -f $srcdir/version.c; then fi dnl Find test suite files. -test_suites=`ls $srcdir/test/test_*.c | egrep -v 'BASE|BACKUP|LOCAL|REMOTE' | xargs echo` +test_suites=`ls $srcdir/unittest/test_*.c | egrep -v 'BASE|BACKUP|LOCAL|REMOTE' | xargs echo` AC_CONFIG_FILES([Makefile]) AC_OUTPUT @@ -185,7 +185,7 @@ cat config.h >>config.h.tmp echo '#endif' >>config.h.tmp mv config.h.tmp config.h -mkdir -p .deps test +mkdir -p .deps unittest AC_MSG_NOTICE(now build ccache by running make) diff --git a/dev.mk.in b/dev.mk.in index 9b681beac2..3254bd5a74 100644 --- a/dev.mk.in +++ b/dev.mk.in @@ -46,12 +46,12 @@ headers = \ mdfour.h \ murmurhashneutral2.h \ system.h \ - test/framework.h \ - test/suites.h \ - test/util.h + unittest/framework.h \ + unittest/suites.h \ + unittest/util.h files_to_clean += *.tar.bz2 *.tar.gz *.tar.xz *.xml .deps/* perfdir.* -files_to_distclean += $(built_dist_files) version.c test/suites.h +files_to_distclean += $(built_dist_files) version.c unittest/suites.h files_to_distclean += .deps version.c dev.mk source_dist_files = \ @@ -59,8 +59,8 @@ source_dist_files = \ $(headers) \ $(test_sources) \ AUTHORS.txt \ + CONTRIBUTING.md \ GPL-3.0.txt \ - HACKING.txt \ LICENSE.txt \ MANUAL.txt \ Makefile.in \ @@ -80,7 +80,8 @@ source_dist_files = \ install-sh \ m4 \ main.c \ - test.sh \ + test/run \ + test/suites/* \ zlib/*.c \ zlib/*.h diff --git a/test.sh b/test/run similarity index 99% rename from test.sh rename to test/run index 62940f738d..10214b73d3 100755 --- a/test.sh +++ b/test/run @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # A simple test suite for ccache. # @@ -364,7 +364,7 @@ nvcc_nocpp2 " for suite in $all_suites; do - . test_suites/$suite.sh + . $(dirname $0)/suites/$suite.bash done # --------------------------------------- diff --git a/test_suites/base.sh b/test/suites/base.bash similarity index 100% rename from test_suites/base.sh rename to test/suites/base.bash diff --git a/test_suites/basedir.sh b/test/suites/basedir.bash similarity index 100% rename from test_suites/basedir.sh rename to test/suites/basedir.bash diff --git a/test_suites/cleanup.sh b/test/suites/cleanup.bash similarity index 100% rename from test_suites/cleanup.sh rename to test/suites/cleanup.bash diff --git a/test_suites/compression.sh b/test/suites/compression.bash similarity index 100% rename from test_suites/compression.sh rename to test/suites/compression.bash diff --git a/test_suites/debug_prefix_map.sh b/test/suites/debug_prefix_map.bash similarity index 100% rename from test_suites/debug_prefix_map.sh rename to test/suites/debug_prefix_map.bash diff --git a/test_suites/direct.sh b/test/suites/direct.bash similarity index 100% rename from test_suites/direct.sh rename to test/suites/direct.bash diff --git a/test_suites/hardlink.sh b/test/suites/hardlink.bash similarity index 100% rename from test_suites/hardlink.sh rename to test/suites/hardlink.bash diff --git a/test_suites/input_charset.sh b/test/suites/input_charset.bash similarity index 100% rename from test_suites/input_charset.sh rename to test/suites/input_charset.bash diff --git a/test_suites/masquerading.sh b/test/suites/masquerading.bash similarity index 100% rename from test_suites/masquerading.sh rename to test/suites/masquerading.bash diff --git a/test_suites/multi_arch.sh b/test/suites/multi_arch.bash similarity index 100% rename from test_suites/multi_arch.sh rename to test/suites/multi_arch.bash diff --git a/test_suites/nocpp2.sh b/test/suites/nocpp2.bash similarity index 100% rename from test_suites/nocpp2.sh rename to test/suites/nocpp2.bash diff --git a/test_suites/nvcc.sh b/test/suites/nvcc.bash similarity index 100% rename from test_suites/nvcc.sh rename to test/suites/nvcc.bash diff --git a/test_suites/nvcc_direct.sh b/test/suites/nvcc_direct.bash similarity index 100% rename from test_suites/nvcc_direct.sh rename to test/suites/nvcc_direct.bash diff --git a/test_suites/nvcc_ldir.sh b/test/suites/nvcc_ldir.bash similarity index 100% rename from test_suites/nvcc_ldir.sh rename to test/suites/nvcc_ldir.bash diff --git a/test_suites/nvcc_nocpp2.sh b/test/suites/nvcc_nocpp2.bash similarity index 100% rename from test_suites/nvcc_nocpp2.sh rename to test/suites/nvcc_nocpp2.bash diff --git a/test_suites/pch.sh b/test/suites/pch.bash similarity index 100% rename from test_suites/pch.sh rename to test/suites/pch.bash diff --git a/test_suites/readonly.sh b/test/suites/readonly.bash similarity index 100% rename from test_suites/readonly.sh rename to test/suites/readonly.bash diff --git a/test_suites/readonly_direct.sh b/test/suites/readonly_direct.bash similarity index 100% rename from test_suites/readonly_direct.sh rename to test/suites/readonly_direct.bash diff --git a/test_suites/serialize_diagnostics.sh b/test/suites/serialize_diagnostics.bash similarity index 100% rename from test_suites/serialize_diagnostics.sh rename to test/suites/serialize_diagnostics.bash diff --git a/test_suites/upgrade.sh b/test/suites/upgrade.bash similarity index 100% rename from test_suites/upgrade.sh rename to test/suites/upgrade.bash diff --git a/test/framework.c b/unittest/framework.c similarity index 100% rename from test/framework.c rename to unittest/framework.c diff --git a/test/framework.h b/unittest/framework.h similarity index 100% rename from test/framework.h rename to unittest/framework.h diff --git a/test/main.c b/unittest/main.c similarity index 100% rename from test/main.c rename to unittest/main.c diff --git a/test/test_args.c b/unittest/test_args.c similarity index 100% rename from test/test_args.c rename to unittest/test_args.c diff --git a/test/test_argument_processing.c b/unittest/test_argument_processing.c similarity index 100% rename from test/test_argument_processing.c rename to unittest/test_argument_processing.c diff --git a/test/test_compopt.c b/unittest/test_compopt.c similarity index 100% rename from test/test_compopt.c rename to unittest/test_compopt.c diff --git a/test/test_conf.c b/unittest/test_conf.c similarity index 100% rename from test/test_conf.c rename to unittest/test_conf.c diff --git a/test/test_counters.c b/unittest/test_counters.c similarity index 100% rename from test/test_counters.c rename to unittest/test_counters.c diff --git a/test/test_hash.c b/unittest/test_hash.c similarity index 100% rename from test/test_hash.c rename to unittest/test_hash.c diff --git a/test/test_hashutil.c b/unittest/test_hashutil.c similarity index 100% rename from test/test_hashutil.c rename to unittest/test_hashutil.c diff --git a/test/test_lockfile.c b/unittest/test_lockfile.c similarity index 100% rename from test/test_lockfile.c rename to unittest/test_lockfile.c diff --git a/test/test_stats.c b/unittest/test_stats.c similarity index 100% rename from test/test_stats.c rename to unittest/test_stats.c diff --git a/test/test_util.c b/unittest/test_util.c similarity index 100% rename from test/test_util.c rename to unittest/test_util.c diff --git a/test/util.c b/unittest/util.c similarity index 100% rename from test/util.c rename to unittest/util.c diff --git a/test/util.h b/unittest/util.h similarity index 100% rename from test/util.h rename to unittest/util.h