auto test support initial

This commit is contained in:
Priyesh Padmavilasom 2015-11-01 21:53:32 +00:00
parent 3c74e3d080
commit 4efff77cd0
5 changed files with 64 additions and 0 deletions

3
.gitignore vendored
View File

@ -28,6 +28,9 @@ ar-lib
/tools/cli/.deps
/tools/cli/.libs
/tools/cli/tdnf
/tests/atconfig
/tests/testsuite
/tests/package.m4
# Object files
*.o

View File

@ -5,4 +5,5 @@ include_HEADERS = include/tdnfclient.h include/tdnferror.h include/tdnftypes.h
SUBDIRS = \
client \
tests \
tools

View File

@ -4,6 +4,8 @@ AC_MSG_NOTICE([tdnf configuration])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_TESTDIR(tests)
AM_PROG_AR
AC_PROG_CC
@ -46,6 +48,7 @@ AC_CHECK_LIB(rpm, rpmtsCreate)
#makefiles
AC_CONFIG_FILES([Makefile
client/Makefile
tests/Makefile
tools/Makefile
tools/cli/Makefile
])

40
tests/Makefile.am Normal file
View File

@ -0,0 +1,40 @@
# The `:;' works around a Bash 3.2 bug when the output is not writeable.
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
:;{ \
echo '# Signature of the current package.' && \
echo 'm4_define([AT_PACKAGE_NAME],' && \
echo ' [$(PACKAGE_NAME)])' && \
echo 'm4_define([AT_PACKAGE_TARNAME],' && \
echo ' [$(PACKAGE_TARNAME)])' && \
echo 'm4_define([AT_PACKAGE_VERSION],' && \
echo ' [$(PACKAGE_VERSION)])' && \
echo 'm4_define([AT_PACKAGE_STRING],' && \
echo ' [$(PACKAGE_STRING)])' && \
echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \
echo ' [$(PACKAGE_BUGREPORT)])'; \
echo 'm4_define([AT_PACKAGE_URL],' && \
echo ' [$(PACKAGE_URL)])'; \
} >'$(srcdir)/package.m4'
EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE)
TESTSUITE = $(srcdir)/testsuite
DISTCLEANFILES = atconfig
check-local: atconfig $(TESTSUITE)
$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
installcheck-local: atconfig $(TESTSUITE)
$(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
$(TESTSUITEFLAGS)
clean-local:
test ! -f '$(TESTSUITE)' || \
$(SHELL) '$(TESTSUITE)' --clean
AUTOM4TE = $(SHELL) $(top_srcdir)/missing --run autom4te
AUTOTEST = $(AUTOM4TE) --language=autotest
$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4
$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
mv $@.tmp $@

17
tests/testsuite.at Normal file
View File

@ -0,0 +1,17 @@
AT_INIT
AT_BANNER([tdnf tests.])
AT_SETUP([version])
AT_KEYWORDS([version])
AT_CHECK([$abs_top_builddir/tools/cli/tdnf --version], [0], [ignore], [ignore])
AT_CLEANUP
AT_SETUP([list downgrades])
AT_KEYWORDS([list downgrades])
AT_CHECK([$abs_top_builddir/tools/cli/tdnf list downgrades], [0], [ignore], [ignore])
AT_CLEANUP
AT_SETUP([install non existent])
AT_KEYWORDS([install non existent])
AT_CHECK([$abs_top_builddir/tools/cli/tdnf install pkg-not-found], [65], [ignore], [ignore])
AT_CLEANUP