make test: run all tests, make fullcheck: run tests and distcheck
This commit is contained in:
parent
62b1d94e95
commit
448deebb83
11
Makefile.am
11
Makefile.am
@ -33,4 +33,15 @@ installer: plat/win32/installer.iss
|
||||
$(MEDIT_INNO_COMPILER) plat/win32/installer.iss
|
||||
endif
|
||||
|
||||
test:
|
||||
$(MAKE) $(AM_MAKEFLAGS) all
|
||||
$(MAKE) $(AM_MAKEFLAGS) check
|
||||
$(MAKE) $(AM_MAKEFLAGS) uninstall
|
||||
$(MAKE) $(AM_MAKEFLAGS) check
|
||||
$(MAKE) $(AM_MAKEFLAGS) install
|
||||
IGNORE_COVERAGE=1 $(MAKE) $(AM_MAKEFLAGS) installcheck
|
||||
fullcheck:
|
||||
$(MAKE) $(AM_MAKEFLAGS) test
|
||||
IGNORE_COVERAGE=1 $(MAKE) $(AM_MAKEFLAGS) distcheck
|
||||
|
||||
@MOO_PO_SUBDIRS_RULE@
|
||||
|
@ -41,6 +41,9 @@ include medit-app/Makefile.incl
|
||||
BUILT_SOURCES += $(built_moo_sources) $(built_plugin_sources)
|
||||
CLEANFILES += $(built_moo_sources) $(built_plugin_sources)
|
||||
|
||||
test:
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) test
|
||||
|
||||
# glade/%-gxml.h: glade/%.glade $(top_srcdir)/tools/glade2c.py
|
||||
# $(MKDIR_P) glade
|
||||
# $(PYTHON) $(top_srcdir)/tools/glade2c.py $< > $@.tmp && mv $@.tmp $@
|
||||
|
@ -5,13 +5,22 @@ dist-hook: delete-junk-from-data
|
||||
delete-junk-from-data:
|
||||
rm -rf `find $(distdir)/medit-app/data -name '*~'`
|
||||
|
||||
EXTRA_DIST += medit-app/run-tests-am.sh medit-app/print-functions.py
|
||||
TESTS = medit-app/run-tests-am.sh
|
||||
TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) PYTHON=$(PYTHON) print_functions=$(srcdir)/medit-app/print-functions.py
|
||||
EXTRA_DIST += \
|
||||
medit-app/run-tests.sh \
|
||||
medit-app/print-functions.py \
|
||||
medit-app/run-tests-installed.sh \
|
||||
medit-app/run-tests-uninstalled.sh
|
||||
|
||||
installcheck-local: unit-tests-installed
|
||||
unit-tests-installed:
|
||||
medit --ut --ut-installed
|
||||
TESTS = medit-app/run-tests-uninstalled.sh
|
||||
TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) bindir=$(bindir) PYTHON=$(PYTHON) print_functions=$(srcdir)/medit-app/print-functions.py
|
||||
|
||||
installcheck-local: run-tests-installed
|
||||
run-tests-installed:
|
||||
$(TESTS_ENVIRONMENT) srcdir=$(srcdir) $(srcdir)/medit-app/run-tests-installed.sh
|
||||
@echo 'PASS: medit-app/run-tests-installed.sh'
|
||||
@echo '============='
|
||||
@echo '1 test passed'
|
||||
@echo '============='
|
||||
|
||||
if MOO_OS_UNIX
|
||||
AM_CFLAGS += -DMOO_UNIT_TEST_DATA_DIR=\"${MOO_TOP_SRCDIR}/moo/medit-app/data\"
|
||||
|
@ -54,7 +54,7 @@ static struct MeditOpts {
|
||||
gboolean show_version;
|
||||
const char *debug;
|
||||
gboolean ut;
|
||||
gboolean ut_installed;
|
||||
gboolean ut_uninstalled;
|
||||
gboolean ut_list;
|
||||
char *ut_dir;
|
||||
char *ut_coverage_file;
|
||||
@ -163,8 +163,8 @@ static GOptionEntry medit_options[] = {
|
||||
/* help message for command line option --version */ N_("Show version information and exit"), NULL },
|
||||
{ "ut", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &medit_opts.ut,
|
||||
"Run unit tests", NULL },
|
||||
{ "ut-installed", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &medit_opts.ut_installed,
|
||||
"Run unit tests in installed medit", NULL },
|
||||
{ "ut-uninstalled", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &medit_opts.ut_uninstalled,
|
||||
"Run unit tests in uninstalled medit", NULL },
|
||||
{ "ut-dir", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &medit_opts.ut_dir,
|
||||
"Data dir for unit tests", NULL },
|
||||
{ "ut-coverage", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME, &medit_opts.ut_coverage_file,
|
||||
@ -528,7 +528,7 @@ unit_test_func (void)
|
||||
MooTestOptions opts = 0;
|
||||
int status;
|
||||
|
||||
if (medit_opts.ut_installed)
|
||||
if (!medit_opts.ut_uninstalled)
|
||||
opts |= MOO_TEST_INSTALLED;
|
||||
|
||||
status = unit_tests_main (opts, medit_opts.ut_tests, medit_opts.ut_dir, medit_opts.ut_coverage_file);
|
||||
|
@ -1,25 +0,0 @@
|
||||
#! /bin/sh
|
||||
echo ./medit --ut --ut-coverage called-functions
|
||||
./medit --ut --ut-coverage called-functions || exit $?
|
||||
sort called-functions > called-functions.tmp || exit 1
|
||||
mv called-functions.tmp called-functions || exit 1
|
||||
|
||||
moo_xml=$top_srcdir/api/moo.xml
|
||||
gtk_xml=$top_srcdir/api/gtk.xml
|
||||
[ -f $moo_xml ] || { echo "file $moo_xml doesn't exist"; exit 1; }
|
||||
[ -f $gtk_xml ] || { echo "file $gtk_xml doesn't exist"; exit 1; }
|
||||
|
||||
$PYTHON $print_functions $moo_xml $gtk_xml > all-functions.tmp || exit 1
|
||||
sort all-functions.tmp > all-functions.tmp2 || exit 1
|
||||
mv all-functions.tmp2 all-functions || exit 1
|
||||
rm -f all-functions.tmp all-functions.tmp2
|
||||
|
||||
comm -3 -2 all-functions called-functions > not-covered-functions
|
||||
|
||||
if [ -z "$IGNORE_COVERAGE" ] && [ -s not-covered-functions ]; then
|
||||
echo "*** Not all functions are covered, see file not-covered-functions"
|
||||
exit 1
|
||||
else
|
||||
rm -f all-functions called-functions not-covered-functions
|
||||
exit 0
|
||||
fi
|
9
moo/medit-app/run-tests-installed.sh
Executable file
9
moo/medit-app/run-tests-installed.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#! /bin/sh
|
||||
|
||||
if [ -z $IGNORE_COVERAGE ]; then
|
||||
coverage_arg=--coverage
|
||||
else
|
||||
coverage_arg=
|
||||
fi
|
||||
|
||||
exec $srcdir/medit-app/run-tests.sh --installed $coverage_arg
|
4
moo/medit-app/run-tests-uninstalled.sh
Executable file
4
moo/medit-app/run-tests-uninstalled.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#! /bin/sh
|
||||
|
||||
echo $srcdir/medit-app/run-tests.sh --uninstalled
|
||||
exec $srcdir/medit-app/run-tests.sh --uninstalled
|
@ -20,7 +20,7 @@ add_tests (MooTestOptions opts)
|
||||
moo_test_mooutils_win32 ();
|
||||
#endif
|
||||
|
||||
moo_test_lua ();
|
||||
moo_test_lua (opts);
|
||||
|
||||
#ifdef MOO_ENABLE_PYTHON
|
||||
moo_test_python ();
|
||||
|
77
moo/medit-app/run-tests.sh
Executable file
77
moo/medit-app/run-tests.sh
Executable file
@ -0,0 +1,77 @@
|
||||
#! /bin/sh
|
||||
|
||||
coverage=false
|
||||
uninstalled=false
|
||||
|
||||
for arg; do
|
||||
case $arg in
|
||||
--installed)
|
||||
uninstalled=false
|
||||
;;
|
||||
--uninstalled)
|
||||
uninstalled=true
|
||||
;;
|
||||
--coverage)
|
||||
coverage=true
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option $arg"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if $uninstalled; then
|
||||
if ! [ -e ./medit ]; then
|
||||
echo "file ./medit doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
medit_cmd_line="./medit --ut --ut-uninstalled"
|
||||
else
|
||||
if [ -z $bindir ]; then
|
||||
medit=`which medit`
|
||||
else
|
||||
medit=$bindir/medit
|
||||
fi
|
||||
if ! [ -e $medit ]; then
|
||||
echo "file $medit doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
if [ ./medit -nt $medit ]; then
|
||||
echo "file ./medit is newer than '$medit', did you forget run make install?"
|
||||
exit 1
|
||||
fi
|
||||
medit_cmd_line="$medit --ut"
|
||||
fi
|
||||
|
||||
if $coverage; then
|
||||
medit_cmd_line="$medit_cmd_line --ut-coverage called-functions"
|
||||
fi
|
||||
|
||||
echo "$medit_cmd_line"
|
||||
$medit_cmd_line || exit $?
|
||||
|
||||
if $coverage; then
|
||||
sort called-functions > called-functions.tmp || exit 1
|
||||
mv called-functions.tmp called-functions || exit 1
|
||||
|
||||
moo_xml=$top_srcdir/api/moo.xml
|
||||
gtk_xml=$top_srcdir/api/gtk.xml
|
||||
[ -f $moo_xml ] || { echo "file $moo_xml doesn't exist"; exit 1; }
|
||||
[ -f $gtk_xml ] || { echo "file $gtk_xml doesn't exist"; exit 1; }
|
||||
|
||||
$PYTHON $print_functions $moo_xml $gtk_xml > all-functions.tmp || exit 1
|
||||
sort all-functions.tmp > all-functions.tmp2 || exit 1
|
||||
mv all-functions.tmp2 all-functions || exit 1
|
||||
rm -f all-functions.tmp all-functions.tmp2
|
||||
|
||||
comm -3 -2 all-functions called-functions > not-covered-functions
|
||||
|
||||
if [ -z "$IGNORE_COVERAGE" ] && [ -s not-covered-functions ]; then
|
||||
echo "*** Not all functions are covered, see file not-covered-functions"
|
||||
exit 1
|
||||
else
|
||||
rm -f all-functions called-functions not-covered-functions
|
||||
exit 0
|
||||
fi
|
||||
fi
|
@ -112,12 +112,15 @@ moo_lua_test_data_free (gpointer udata)
|
||||
}
|
||||
|
||||
void
|
||||
moo_test_lua (void)
|
||||
moo_test_lua (MooTestOptions opts)
|
||||
{
|
||||
MooLuaTestData *data;
|
||||
MooTestSuite *suite;
|
||||
char **p;
|
||||
|
||||
if (!(opts & MOO_TEST_INSTALLED))
|
||||
return;
|
||||
|
||||
data = moo_lua_test_data_new ();
|
||||
suite = moo_test_suite_new ("MooLua", "Lua scripting tests", NULL, moo_lua_test_data_free, data);
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void moo_test_lua (void);
|
||||
void moo_test_lua (MooTestOptions opts);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user