mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-11-03 20:54:07 +01:00
Tests fail
This commit is contained in:
parent
8b580fee4a
commit
69ffb6c3b5
15
Makefile.am
15
Makefile.am
@ -53,9 +53,6 @@ AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include
|
||||
lib_LTLIBRARIES = src/libtrexio.la
|
||||
|
||||
|
||||
SOURCE_FILES= trexio.c trexio_hdf5.c trexio_text.c
|
||||
HEADER_FILES= $(trexio_h) trexio_text.h trexio_hdf5.h trexio_s.h
|
||||
|
||||
SOURCES = \
|
||||
$(trexio_h) \
|
||||
$(srcdir)/src/trexio.c \
|
||||
@ -75,13 +72,16 @@ ORG_FILES = \
|
||||
|
||||
src_libtrexio_la_SOURCES = $(SOURCES)
|
||||
|
||||
check_PROGRAMS = tests/test_c tests/test_f
|
||||
TESTS = tests/test_c tests/test_f
|
||||
check_PROGRAMS = $(TESTS)
|
||||
|
||||
tests_test_c_SOURCES = tests/test.c $(trexio_h)
|
||||
tests_test_c_LDADD = src/libtrexio.la
|
||||
tests_test_c_LDFLAGS = -no-install
|
||||
|
||||
tests_test_f_SOURCES = tests/test_f.f90 $(trexio_h) $(trexio_f)
|
||||
test_trexio_f = $(srcdir)/tests/trexio_f.f90
|
||||
|
||||
tests_test_f_SOURCES = $(trexio_h) $(test_trexio_f)
|
||||
tests_test_f_LDADD = src/libtrexio.la
|
||||
tests_test_f_LDFLAGS = -no-install
|
||||
|
||||
@ -89,7 +89,10 @@ if TREXIO_DEVEL
|
||||
|
||||
CLEANFILES += $(SOURCES) $(trexio_f) $(trexio_h)
|
||||
|
||||
BUILT_SOURCES = $(SOURCES)
|
||||
BUILT_SOURCES = $(SOURCES) $(trexio_f) $(trexio_h)
|
||||
|
||||
$(test_trexio_f): $(trexio_f)
|
||||
cp $(trexio_f) $(test_trexio_f)
|
||||
|
||||
src/trexio.c: $(trexio_h)
|
||||
|
||||
|
397
Makefile.in
397
Makefile.in
@ -122,7 +122,8 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
check_PROGRAMS = tests/test_c$(EXEEXT) tests/test_f$(EXEEXT)
|
||||
TESTS = tests/test_c$(EXEEXT) tests/test_f$(EXEEXT)
|
||||
check_PROGRAMS = $(am__EXEEXT_1)
|
||||
@TREXIO_DEVEL_TRUE@am__append_1 = $(SOURCES) $(trexio_f) $(trexio_h)
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
@ -140,6 +141,7 @@ mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/include/config.h
|
||||
CONFIG_CLEAN_FILES = pkgconfig/trexio.pc
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__EXEEXT_1 = tests/test_c$(EXEEXT) tests/test_f$(EXEEXT)
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
@ -187,9 +189,8 @@ tests_test_c_DEPENDENCIES = src/libtrexio.la
|
||||
tests_test_c_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(tests_test_c_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am__objects_3 = include/trexio_f.$(OBJEXT)
|
||||
am_tests_test_f_OBJECTS = tests/test_f.$(OBJEXT) $(am__objects_1) \
|
||||
$(am__objects_3)
|
||||
am__objects_3 = tests/trexio_f.$(OBJEXT)
|
||||
am_tests_test_f_OBJECTS = $(am__objects_1) $(am__objects_3)
|
||||
tests_test_f_OBJECTS = $(am_tests_test_f_OBJECTS)
|
||||
tests_test_f_DEPENDENCIES = src/libtrexio.la
|
||||
tests_test_f_LINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \
|
||||
@ -271,7 +272,8 @@ am__recursive_targets = \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
cscope distdir distdir-am dist dist-all distcheck
|
||||
cscope check recheck distdir distdir-am dist dist-all \
|
||||
distcheck
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
@ -292,12 +294,188 @@ am__define_uniq_tagged_files = \
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
am__tty_colors_dummy = \
|
||||
mgn= red= grn= lgn= blu= brg= std=; \
|
||||
am__color_tests=no
|
||||
am__tty_colors = { \
|
||||
$(am__tty_colors_dummy); \
|
||||
if test "X$(AM_COLOR_TESTS)" = Xno; then \
|
||||
am__color_tests=no; \
|
||||
elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
|
||||
am__color_tests=yes; \
|
||||
elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
|
||||
am__color_tests=yes; \
|
||||
fi; \
|
||||
if test $$am__color_tests = yes; then \
|
||||
red='[0;31m'; \
|
||||
grn='[0;32m'; \
|
||||
lgn='[1;32m'; \
|
||||
blu='[1;34m'; \
|
||||
mgn='[0;35m'; \
|
||||
brg='[1m'; \
|
||||
std='[m'; \
|
||||
fi; \
|
||||
}
|
||||
am__recheck_rx = ^[ ]*:recheck:[ ]*
|
||||
am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
|
||||
am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
|
||||
# A command that, given a newline-separated list of test names on the
|
||||
# standard input, print the name of the tests that are to be re-run
|
||||
# upon "make recheck".
|
||||
am__list_recheck_tests = $(AWK) '{ \
|
||||
recheck = 1; \
|
||||
while ((rc = (getline line < ($$0 ".trs"))) != 0) \
|
||||
{ \
|
||||
if (rc < 0) \
|
||||
{ \
|
||||
if ((getline line2 < ($$0 ".log")) < 0) \
|
||||
recheck = 0; \
|
||||
break; \
|
||||
} \
|
||||
else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
|
||||
{ \
|
||||
recheck = 0; \
|
||||
break; \
|
||||
} \
|
||||
else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
|
||||
{ \
|
||||
break; \
|
||||
} \
|
||||
}; \
|
||||
if (recheck) \
|
||||
print $$0; \
|
||||
close ($$0 ".trs"); \
|
||||
close ($$0 ".log"); \
|
||||
}'
|
||||
# A command that, given a newline-separated list of test names on the
|
||||
# standard input, create the global log from their .trs and .log files.
|
||||
am__create_global_log = $(AWK) ' \
|
||||
function fatal(msg) \
|
||||
{ \
|
||||
print "fatal: making $@: " msg | "cat >&2"; \
|
||||
exit 1; \
|
||||
} \
|
||||
function rst_section(header) \
|
||||
{ \
|
||||
print header; \
|
||||
len = length(header); \
|
||||
for (i = 1; i <= len; i = i + 1) \
|
||||
printf "="; \
|
||||
printf "\n\n"; \
|
||||
} \
|
||||
{ \
|
||||
copy_in_global_log = 1; \
|
||||
global_test_result = "RUN"; \
|
||||
while ((rc = (getline line < ($$0 ".trs"))) != 0) \
|
||||
{ \
|
||||
if (rc < 0) \
|
||||
fatal("failed to read from " $$0 ".trs"); \
|
||||
if (line ~ /$(am__global_test_result_rx)/) \
|
||||
{ \
|
||||
sub("$(am__global_test_result_rx)", "", line); \
|
||||
sub("[ ]*$$", "", line); \
|
||||
global_test_result = line; \
|
||||
} \
|
||||
else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
|
||||
copy_in_global_log = 0; \
|
||||
}; \
|
||||
if (copy_in_global_log) \
|
||||
{ \
|
||||
rst_section(global_test_result ": " $$0); \
|
||||
while ((rc = (getline line < ($$0 ".log"))) != 0) \
|
||||
{ \
|
||||
if (rc < 0) \
|
||||
fatal("failed to read from " $$0 ".log"); \
|
||||
print line; \
|
||||
}; \
|
||||
printf "\n"; \
|
||||
}; \
|
||||
close ($$0 ".trs"); \
|
||||
close ($$0 ".log"); \
|
||||
}'
|
||||
# Restructured Text title.
|
||||
am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
|
||||
# Solaris 10 'make', and several other traditional 'make' implementations,
|
||||
# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
|
||||
# by disabling -e (using the XSI extension "set +e") if it's set.
|
||||
am__sh_e_setup = case $$- in *e*) set +e;; esac
|
||||
# Default flags passed to test drivers.
|
||||
am__common_driver_flags = \
|
||||
--color-tests "$$am__color_tests" \
|
||||
--enable-hard-errors "$$am__enable_hard_errors" \
|
||||
--expect-failure "$$am__expect_failure"
|
||||
# To be inserted before the command running the test. Creates the
|
||||
# directory for the log if needed. Stores in $dir the directory
|
||||
# containing $f, in $tst the test, in $log the log. Executes the
|
||||
# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
|
||||
# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
|
||||
# will run the test scripts (or their associated LOG_COMPILER, if
|
||||
# thy have one).
|
||||
am__check_pre = \
|
||||
$(am__sh_e_setup); \
|
||||
$(am__vpath_adj_setup) $(am__vpath_adj) \
|
||||
$(am__tty_colors); \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
case "$@" in \
|
||||
*/*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
|
||||
*) am__odir=.;; \
|
||||
esac; \
|
||||
test "x$$am__odir" = x"." || test -d "$$am__odir" \
|
||||
|| $(MKDIR_P) "$$am__odir" || exit $$?; \
|
||||
if test -f "./$$f"; then dir=./; \
|
||||
elif test -f "$$f"; then dir=; \
|
||||
else dir="$(srcdir)/"; fi; \
|
||||
tst=$$dir$$f; log='$@'; \
|
||||
if test -n '$(DISABLE_HARD_ERRORS)'; then \
|
||||
am__enable_hard_errors=no; \
|
||||
else \
|
||||
am__enable_hard_errors=yes; \
|
||||
fi; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
|
||||
am__expect_failure=yes;; \
|
||||
*) \
|
||||
am__expect_failure=no;; \
|
||||
esac; \
|
||||
$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
|
||||
# A shell command to get the names of the tests scripts with any registered
|
||||
# extension removed (i.e., equivalently, the names of the test logs, with
|
||||
# the '.log' extension removed). The result is saved in the shell variable
|
||||
# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
|
||||
# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
|
||||
# since that might cause problem with VPATH rewrites for suffix-less tests.
|
||||
# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
|
||||
am__set_TESTS_bases = \
|
||||
bases='$(TEST_LOGS)'; \
|
||||
bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
|
||||
bases=`echo $$bases`
|
||||
RECHECK_LOGS = $(TEST_LOGS)
|
||||
TEST_SUITE_LOG = test-suite.log
|
||||
TEST_EXTENSIONS = @EXEEXT@ .test
|
||||
LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
|
||||
LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
|
||||
am__set_b = \
|
||||
case '$@' in \
|
||||
*/*) \
|
||||
case '$*' in \
|
||||
*/*) b='$*';; \
|
||||
*) b=`echo '$@' | sed 's/\.log$$//'`; \
|
||||
esac;; \
|
||||
*) \
|
||||
b='$*';; \
|
||||
esac
|
||||
am__test_logs1 = $(TESTS:=.log)
|
||||
am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
|
||||
TEST_LOGS = $(am__test_logs2:.test.log=.log)
|
||||
TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
|
||||
TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
|
||||
$(TEST_LOG_FLAGS)
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in \
|
||||
$(top_srcdir)/include/config.h.in \
|
||||
$(top_srcdir)/pkgconfig/trexio.pc.in AUTHORS COPYING ChangeLog \
|
||||
INSTALL NEWS README compile config.guess config.sub depcomp \
|
||||
install-sh ltmain.sh missing
|
||||
install-sh ltmain.sh missing test-driver
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
@ -494,8 +672,6 @@ trexio_f = $(srcdir)/include/trexio_f.f90
|
||||
include_HEADERS = $(trexio_h) $(trexio_f)
|
||||
AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include
|
||||
lib_LTLIBRARIES = src/libtrexio.la
|
||||
SOURCE_FILES = trexio.c trexio_hdf5.c trexio_text.c
|
||||
HEADER_FILES = $(trexio_h) trexio_text.h trexio_hdf5.h trexio_s.h
|
||||
SOURCES = \
|
||||
$(trexio_h) \
|
||||
$(srcdir)/src/trexio.c \
|
||||
@ -516,15 +692,16 @@ src_libtrexio_la_SOURCES = $(SOURCES)
|
||||
tests_test_c_SOURCES = tests/test.c $(trexio_h)
|
||||
tests_test_c_LDADD = src/libtrexio.la
|
||||
tests_test_c_LDFLAGS = -no-install
|
||||
tests_test_f_SOURCES = tests/test_f.f90 $(trexio_h) $(trexio_f)
|
||||
test_trexio_f = $(srcdir)/tests/trexio_f.f90
|
||||
tests_test_f_SOURCES = $(trexio_h) $(test_trexio_f)
|
||||
tests_test_f_LDADD = src/libtrexio.la
|
||||
tests_test_f_LDFLAGS = -no-install
|
||||
@TREXIO_DEVEL_TRUE@BUILT_SOURCES = $(SOURCES)
|
||||
@TREXIO_DEVEL_TRUE@BUILT_SOURCES = $(SOURCES) $(trexio_f) $(trexio_h)
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .f90 .lo .o .obj
|
||||
.SUFFIXES: .c .f90 .lo .log .o .obj .test .test$(EXEEXT) .trs
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@ -643,16 +820,8 @@ tests/test.$(OBJEXT): tests/$(am__dirstamp) \
|
||||
tests/test_c$(EXEEXT): $(tests_test_c_OBJECTS) $(tests_test_c_DEPENDENCIES) $(EXTRA_tests_test_c_DEPENDENCIES) tests/$(am__dirstamp)
|
||||
@rm -f tests/test_c$(EXEEXT)
|
||||
$(AM_V_CCLD)$(tests_test_c_LINK) $(tests_test_c_OBJECTS) $(tests_test_c_LDADD) $(LIBS)
|
||||
tests/test_f.$(OBJEXT): tests/$(am__dirstamp) \
|
||||
tests/trexio_f.$(OBJEXT): tests/$(am__dirstamp) \
|
||||
tests/$(DEPDIR)/$(am__dirstamp)
|
||||
include/$(am__dirstamp):
|
||||
@$(MKDIR_P) include
|
||||
@: > include/$(am__dirstamp)
|
||||
include/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) include/$(DEPDIR)
|
||||
@: > include/$(DEPDIR)/$(am__dirstamp)
|
||||
include/trexio_f.$(OBJEXT): include/$(am__dirstamp) \
|
||||
include/$(DEPDIR)/$(am__dirstamp)
|
||||
|
||||
tests/test_f$(EXEEXT): $(tests_test_f_OBJECTS) $(tests_test_f_DEPENDENCIES) $(EXTRA_tests_test_f_DEPENDENCIES) tests/$(am__dirstamp)
|
||||
@rm -f tests/test_f$(EXEEXT)
|
||||
@ -660,7 +829,6 @@ tests/test_f$(EXEEXT): $(tests_test_f_OBJECTS) $(tests_test_f_DEPENDENCIES) $(EX
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
-rm -f include/*.$(OBJEXT)
|
||||
-rm -f src/*.$(OBJEXT)
|
||||
-rm -f src/*.lo
|
||||
-rm -f tests/*.$(OBJEXT)
|
||||
@ -871,6 +1039,176 @@ distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
||||
|
||||
# Recover from deleted '.trs' file; this should ensure that
|
||||
# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
|
||||
# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
|
||||
# to avoid problems with "make -n".
|
||||
.log.trs:
|
||||
rm -f $< $@
|
||||
$(MAKE) $(AM_MAKEFLAGS) $<
|
||||
|
||||
# Leading 'am--fnord' is there to ensure the list of targets does not
|
||||
# expand to empty, as could happen e.g. with make check TESTS=''.
|
||||
am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
|
||||
am--force-recheck:
|
||||
@:
|
||||
|
||||
$(TEST_SUITE_LOG): $(TEST_LOGS)
|
||||
@$(am__set_TESTS_bases); \
|
||||
am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
|
||||
redo_bases=`for i in $$bases; do \
|
||||
am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
|
||||
done`; \
|
||||
if test -n "$$redo_bases"; then \
|
||||
redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
|
||||
redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
|
||||
if $(am__make_dryrun); then :; else \
|
||||
rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
if test -n "$$am__remaking_logs"; then \
|
||||
echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
|
||||
"recursion detected" >&2; \
|
||||
elif test -n "$$redo_logs"; then \
|
||||
am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
|
||||
fi; \
|
||||
if $(am__make_dryrun); then :; else \
|
||||
st=0; \
|
||||
errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
|
||||
for i in $$redo_bases; do \
|
||||
test -f $$i.trs && test -r $$i.trs \
|
||||
|| { echo "$$errmsg $$i.trs" >&2; st=1; }; \
|
||||
test -f $$i.log && test -r $$i.log \
|
||||
|| { echo "$$errmsg $$i.log" >&2; st=1; }; \
|
||||
done; \
|
||||
test $$st -eq 0 || exit 1; \
|
||||
fi
|
||||
@$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
|
||||
ws='[ ]'; \
|
||||
results=`for b in $$bases; do echo $$b.trs; done`; \
|
||||
test -n "$$results" || results=/dev/null; \
|
||||
all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
|
||||
pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
|
||||
fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
|
||||
skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
|
||||
xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
|
||||
xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
|
||||
error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
|
||||
if test `expr $$fail + $$xpass + $$error` -eq 0; then \
|
||||
success=true; \
|
||||
else \
|
||||
success=false; \
|
||||
fi; \
|
||||
br='==================='; br=$$br$$br$$br$$br; \
|
||||
result_count () \
|
||||
{ \
|
||||
if test x"$$1" = x"--maybe-color"; then \
|
||||
maybe_colorize=yes; \
|
||||
elif test x"$$1" = x"--no-color"; then \
|
||||
maybe_colorize=no; \
|
||||
else \
|
||||
echo "$@: invalid 'result_count' usage" >&2; exit 4; \
|
||||
fi; \
|
||||
shift; \
|
||||
desc=$$1 count=$$2; \
|
||||
if test $$maybe_colorize = yes && test $$count -gt 0; then \
|
||||
color_start=$$3 color_end=$$std; \
|
||||
else \
|
||||
color_start= color_end=; \
|
||||
fi; \
|
||||
echo "$${color_start}# $$desc $$count$${color_end}"; \
|
||||
}; \
|
||||
create_testsuite_report () \
|
||||
{ \
|
||||
result_count $$1 "TOTAL:" $$all "$$brg"; \
|
||||
result_count $$1 "PASS: " $$pass "$$grn"; \
|
||||
result_count $$1 "SKIP: " $$skip "$$blu"; \
|
||||
result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
|
||||
result_count $$1 "FAIL: " $$fail "$$red"; \
|
||||
result_count $$1 "XPASS:" $$xpass "$$red"; \
|
||||
result_count $$1 "ERROR:" $$error "$$mgn"; \
|
||||
}; \
|
||||
{ \
|
||||
echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
|
||||
$(am__rst_title); \
|
||||
create_testsuite_report --no-color; \
|
||||
echo; \
|
||||
echo ".. contents:: :depth: 2"; \
|
||||
echo; \
|
||||
for b in $$bases; do echo $$b; done \
|
||||
| $(am__create_global_log); \
|
||||
} >$(TEST_SUITE_LOG).tmp || exit 1; \
|
||||
mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
|
||||
if $$success; then \
|
||||
col="$$grn"; \
|
||||
else \
|
||||
col="$$red"; \
|
||||
test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
|
||||
fi; \
|
||||
echo "$${col}$$br$${std}"; \
|
||||
echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
|
||||
echo "$${col}$$br$${std}"; \
|
||||
create_testsuite_report --maybe-color; \
|
||||
echo "$$col$$br$$std"; \
|
||||
if $$success; then :; else \
|
||||
echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
|
||||
if test -n "$(PACKAGE_BUGREPORT)"; then \
|
||||
echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
|
||||
fi; \
|
||||
echo "$$col$$br$$std"; \
|
||||
fi; \
|
||||
$$success || exit 1
|
||||
|
||||
check-TESTS: $(check_PROGRAMS)
|
||||
@list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
|
||||
@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
|
||||
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
|
||||
@set +e; $(am__set_TESTS_bases); \
|
||||
log_list=`for i in $$bases; do echo $$i.log; done`; \
|
||||
trs_list=`for i in $$bases; do echo $$i.trs; done`; \
|
||||
log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
|
||||
exit $$?;
|
||||
recheck: all $(check_PROGRAMS)
|
||||
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
|
||||
@set +e; $(am__set_TESTS_bases); \
|
||||
bases=`for i in $$bases; do echo $$i; done \
|
||||
| $(am__list_recheck_tests)` || exit 1; \
|
||||
log_list=`for i in $$bases; do echo $$i.log; done`; \
|
||||
log_list=`echo $$log_list`; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
|
||||
am__force_recheck=am--force-recheck \
|
||||
TEST_LOGS="$$log_list"; \
|
||||
exit $$?
|
||||
tests/test_c.log: tests/test_c$(EXEEXT)
|
||||
@p='tests/test_c$(EXEEXT)'; \
|
||||
b='tests/test_c'; \
|
||||
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
|
||||
--log-file $$b.log --trs-file $$b.trs \
|
||||
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
||||
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||
tests/test_f.log: tests/test_f$(EXEEXT)
|
||||
@p='tests/test_f$(EXEEXT)'; \
|
||||
b='tests/test_f'; \
|
||||
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
|
||||
--log-file $$b.log --trs-file $$b.trs \
|
||||
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
||||
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||
.test.log:
|
||||
@p='$<'; \
|
||||
$(am__set_b); \
|
||||
$(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
|
||||
--log-file $$b.log --trs-file $$b.trs \
|
||||
$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
|
||||
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||
@am__EXEEXT_TRUE@.test$(EXEEXT).log:
|
||||
@am__EXEEXT_TRUE@ @p='$<'; \
|
||||
@am__EXEEXT_TRUE@ $(am__set_b); \
|
||||
@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
|
||||
@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
|
||||
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
|
||||
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
@ -1064,6 +1402,7 @@ distcleancheck: distclean
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
check: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-recursive
|
||||
all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
|
||||
@ -1093,6 +1432,9 @@ install-strip:
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
-test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
|
||||
-test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
|
||||
-test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
@ -1100,8 +1442,6 @@ clean-generic:
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-rm -f include/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f include/$(am__dirstamp)
|
||||
-rm -f src/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f src/$(am__dirstamp)
|
||||
-rm -f tests/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -1196,7 +1536,7 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
|
||||
install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||
am--depfiles am--refresh check check-am clean \
|
||||
am--depfiles am--refresh check check-TESTS check-am clean \
|
||||
clean-checkPROGRAMS clean-cscope clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool cscope cscopelist-am ctags \
|
||||
ctags-am dist dist-all dist-bzip2 dist-gzip dist-lzip \
|
||||
@ -1212,13 +1552,16 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am uninstall-includeHEADERS uninstall-libLTLIBRARIES \
|
||||
uninstall-pkgconfigDATA
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \
|
||||
uninstall uninstall-am uninstall-includeHEADERS \
|
||||
uninstall-libLTLIBRARIES uninstall-pkgconfigDATA
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
@TREXIO_DEVEL_TRUE@$(test_trexio_f): $(trexio_f)
|
||||
@TREXIO_DEVEL_TRUE@ cp $(trexio_f) $(test_trexio_f)
|
||||
|
||||
@TREXIO_DEVEL_TRUE@src/trexio.c: $(trexio_h)
|
||||
|
||||
@TREXIO_DEVEL_TRUE@$(trexio_h): $(ORG_FILES)
|
||||
|
142
tests/test.c
142
tests/test.c
@ -5,28 +5,29 @@
|
||||
|
||||
int test_read();
|
||||
int test_write();
|
||||
int test_h5read();
|
||||
int test_h5write();
|
||||
|
||||
int main() {
|
||||
|
||||
/*============== Main test launcher ================*/
|
||||
|
||||
test_h5write();
|
||||
test_h5read();
|
||||
int rc;
|
||||
rc = system("rm -rf test_write.h5");
|
||||
assert (rc == 0);
|
||||
test_write("test_write.h5", TREXIO_HDF5);
|
||||
test_read ("test_write.h5", TREXIO_HDF5);
|
||||
|
||||
test_write();
|
||||
test_read();
|
||||
rc = system("rm -rf test_write.dir");
|
||||
assert (rc == 0);
|
||||
test_write("test_write.dir", TREXIO_TEXT);
|
||||
test_read ("test_write.dir", TREXIO_TEXT);
|
||||
|
||||
printf("Test error message: %s\n", trexio_string_of_error(TREXIO_INVALID_ARG_2));
|
||||
return 0 ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_h5write() {
|
||||
int test_write(const char* file_name, const back_end_t backend) {
|
||||
|
||||
/*======== Test write using HDF5 backend ===========*/
|
||||
/*======== Test write ===========*/
|
||||
|
||||
const char* file_name = "test_write.h5";
|
||||
trexio_t* file = NULL;
|
||||
trexio_exit_code rc;
|
||||
|
||||
@ -52,7 +53,7 @@ int test_h5write() {
|
||||
/*================= START OF TEST ==================*/
|
||||
|
||||
// open file in 'write' mode
|
||||
file = trexio_open(file_name, 'w', TREXIO_HDF5);
|
||||
file = trexio_open(file_name, 'w', backend);
|
||||
assert (file != NULL);
|
||||
|
||||
// check that certain data does not exist in the file
|
||||
@ -77,6 +78,7 @@ int test_h5write() {
|
||||
|
||||
// should not work: try to overwrite the nucleus_num
|
||||
rc = trexio_write_nucleus_num(file,25);
|
||||
printf("Test error message: %s\n", trexio_string_of_error(rc));
|
||||
assert (rc == TREXIO_NUM_ALREADY_EXISTS);
|
||||
|
||||
// close current session
|
||||
@ -106,11 +108,10 @@ int test_h5write() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_h5read() {
|
||||
int test_read(const char* file_name, const back_end_t backend) {
|
||||
|
||||
/*========= Test read using HDF5 backend ===========*/
|
||||
/*========= Test read ===========*/
|
||||
|
||||
const char* file_name = "test_write.h5";
|
||||
trexio_t* file = NULL;
|
||||
trexio_exit_code rc;
|
||||
|
||||
@ -119,8 +120,8 @@ int test_h5read() {
|
||||
|
||||
/*================= START OF TEST ==================*/
|
||||
|
||||
// open existing file on 'read' mode [created by test_h5write()]
|
||||
file = trexio_open(file_name, 'r', TREXIO_HDF5);
|
||||
// open existing file on 'read' mode [created by test_write]
|
||||
file = trexio_open(file_name, 'r', backend);
|
||||
assert (file != NULL);
|
||||
|
||||
// read nucleus_num
|
||||
@ -141,16 +142,16 @@ int test_h5read() {
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
// read non-existing file, should fail and return NULL
|
||||
const char* file_name2 = "test_nonexisting.h5";
|
||||
const char* file_name2 = "test_nonexisting";
|
||||
trexio_t* file2 = NULL;
|
||||
|
||||
file2 = trexio_open(file_name2, 'r', TREXIO_HDF5);
|
||||
file2 = trexio_open(file_name2, 'r', backend);
|
||||
assert (file2 == NULL);
|
||||
|
||||
// append non-existing file, should fail and return NULL
|
||||
trexio_t* file3 = NULL;
|
||||
|
||||
file3 = trexio_open(file_name2, 'a', TREXIO_HDF5);
|
||||
file3 = trexio_open(file_name2, 'a', backend);
|
||||
assert (file3 == NULL);
|
||||
|
||||
/*================= END OF TEST =====================*/
|
||||
@ -160,104 +161,3 @@ int test_h5read() {
|
||||
}
|
||||
|
||||
|
||||
int test_write() {
|
||||
|
||||
/*========= Test write using TEXT backend ===========*/
|
||||
|
||||
const char* file_name = "trexio_test";
|
||||
trexio_t* file = NULL;
|
||||
trexio_exit_code rc;
|
||||
|
||||
// parameters to be written
|
||||
int num = 12;
|
||||
float charge[12] = {6., 6., 6., 6., 6., 6., 1., 1., 1., 1., 1., 1.};
|
||||
double coord[36] = {
|
||||
0.00000000 , 1.39250319 , 0.00000000 ,
|
||||
-1.20594314 , 0.69625160 , 0.00000000 ,
|
||||
-1.20594314 , -0.69625160 , 0.00000000 ,
|
||||
0.00000000 , -1.39250319 , 0.00000000 ,
|
||||
1.20594314 , -0.69625160 , 0.00000000 ,
|
||||
1.20594314 , 0.69625160 , 0.00000000 ,
|
||||
-2.14171677 , 1.23652075 , 0.00000000 ,
|
||||
-2.14171677 , -1.23652075 , 0.00000000 ,
|
||||
0.00000000 , -2.47304151 , 0.00000000 ,
|
||||
2.14171677 , -1.23652075 , 0.00000000 ,
|
||||
2.14171677 , 1.23652075 , 0.00000000 ,
|
||||
0.00000000 , 2.47304151 , 0.00000000 ,
|
||||
};
|
||||
|
||||
/*================= START OF TEST ==================*/
|
||||
|
||||
file = trexio_open(file_name, 'w', TREXIO_TEXT);
|
||||
assert (file != NULL);
|
||||
|
||||
rc = trexio_has_nucleus_num(file);
|
||||
assert (rc == TREXIO_HAS_NOT);
|
||||
rc = trexio_has_nucleus_coord(file);
|
||||
assert (rc == TREXIO_HAS_NOT);
|
||||
|
||||
rc = trexio_write_nucleus_num(file,num);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
rc = trexio_write_nucleus_charge_32(file,charge);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
rc = trexio_write_nucleus_coord(file,coord);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
rc = trexio_has_nucleus_num(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
rc = trexio_has_nucleus_coord(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
rc = trexio_close(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
/*================= END OF TEST =====================*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_read() {
|
||||
|
||||
/*========= Test read using TEXT backend ===========*/
|
||||
|
||||
const char* file_name = "trexio_test";
|
||||
trexio_t* file = NULL;
|
||||
trexio_exit_code rc;
|
||||
|
||||
int num;
|
||||
float* charge;
|
||||
double* coord;
|
||||
|
||||
/*================= START OF TEST ==================*/
|
||||
|
||||
file = trexio_open(file_name, 'r', TREXIO_TEXT);
|
||||
assert (file != NULL);
|
||||
|
||||
rc = trexio_read_nucleus_num(file,&num);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
assert (num == 12);
|
||||
|
||||
charge = (float*) calloc(num, sizeof(float));
|
||||
rc = trexio_read_nucleus_charge_32(file,charge);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
assert(charge[10] == 1.);
|
||||
|
||||
coord = (double*) calloc(3*num, sizeof(double));
|
||||
rc = trexio_read_nucleus_coord(file,coord);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
double x = coord[30] - 2.14171677;
|
||||
assert(x*x < 1.e-14);
|
||||
|
||||
rc = trexio_close(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
/*================= END OF TEST =====================*/
|
||||
|
||||
free(charge);
|
||||
free(coord);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user