Skip to content

Commit

Permalink
test: Rearrange files into test and unittest directories
Browse files Browse the repository at this point in the history
* The unit tests formerly located in the test directory have been moved
  to the unittest directory.
* The integration test suite test.sh has been made a bash script and
  renamed to test/run. Its test suites are located in test/suites.
  • Loading branch information
jrosdahl committed Jan 29, 2018
1 parent 01e5169 commit 1fbb9be
Show file tree
Hide file tree
Showing 40 changed files with 32 additions and 30 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
Makefile
autom4te.cache
ccache
ccache.exe
ccache-*.tar.*
ccache.1
ccache.exe
ccache.html
ccache.xml
config.cache
Expand All @@ -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
31 changes: 16 additions & 15 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sysconfdir = @sysconfdir@
installcmd = @INSTALL@

AR = @AR@
SH = @SH@
BASH = @BASH@
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 $@ $<
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
13 changes: 7 additions & 6 deletions dev.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ 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 = \
$(base_sources) \
$(headers) \
$(test_sources) \
AUTHORS.txt \
CONTRIBUTING.md \
GPL-3.0.txt \
HACKING.txt \
LICENSE.txt \
MANUAL.txt \
Makefile.in \
Expand All @@ -80,7 +80,8 @@ source_dist_files = \
install-sh \
m4 \
main.c \
test.sh \
test/run \
test/suites/* \
zlib/*.c \
zlib/*.h

Expand Down
4 changes: 2 additions & 2 deletions test.sh → test/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# A simple test suite for ccache.
#
Expand Down Expand Up @@ -364,7 +364,7 @@ nvcc_nocpp2
"

for suite in $all_suites; do
. test_suites/$suite.sh
. $(dirname $0)/suites/$suite.bash
done

# ---------------------------------------
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1fbb9be

Please sign in to comment.