From e64c6dcb701c9f43fcd181320d8a3094d15a6145 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Mon, 27 Jul 2020 17:16:33 -0600 Subject: [PATCH] support parallel vtesto from qmake. (#612) * support parallel vtesto from qmake. also support testo, vtesto with out of source builds. * force check to run. --- GPSBabel.pro | 13 ++++++----- Makefile_vtesto | 34 +++++++++++++++++++++++++++++ f90g_track.cc | 3 ++- reference/nonexistent.err | 2 +- reference/nonexistent_alternate.err | 2 +- reference/track/f90g-sample.gpx | 2 +- src/core/file.h | 3 ++- testo | 4 ++-- testo.d/xol.test | 6 ++--- 9 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 Makefile_vtesto diff --git a/GPSBabel.pro b/GPSBabel.pro index 944422206..60c6bc7f5 100644 --- a/GPSBabel.pro +++ b/GPSBabel.pro @@ -215,11 +215,14 @@ DEFINES += CSVFMTS_ENABLED QMAKE_CFLAGS_WARN_ON -= -W QMAKE_CXXFLAGS_WARN_ON -= -W -macx|linux|openbsd{ - check.commands = PNAME=./$(TARGET) ./testo - check.depends = $(TARGET) - QMAKE_EXTRA_TARGETS += check -} +check.depends = $(TARGET) FORCE +check.commands = @PNAME=./$(TARGET) $${PWD}/testo +QMAKE_EXTRA_TARGETS += check + +check-vtesto.depends = $(TARGET) FORCE +check-vtesto.commands += @$(MAKE) -s -f $${PWD}/Makefile_vtesto srcdir=$${PWD} builddir=$${OUT_PWD} check-vtesto +QMAKE_EXTRA_TARGETS += check-vtesto +QMAKE_CLEAN += $${OUT_PWD}/testo.d/*.vglog # build the compilation data base used by clang tools including clang-tidy. macx|linux|openbsd{ diff --git a/Makefile_vtesto b/Makefile_vtesto new file mode 100644 index 000000000..4d65d69ee --- /dev/null +++ b/Makefile_vtesto @@ -0,0 +1,34 @@ +# +# Legacy makefile hook for GPSBabel.pro +# This lets us determine the tests when make is run instead +# of when qmake is run. +# The make parallel execution feature can be used. +# +# GPSBabel requires a reasonably recent version of GNU Make. +# We rely on very few fancy features of make so the exact version +# probably doesn't much matter. GNU Make 3.81 seems a reasonable target. +# + +srcdir = . +builddir = . + +TESTCASES := $(sort $(wildcard $(srcdir)/testo.d/*.test)) +VGLOGS := $(addprefix $(builddir)/testo.d/, $(addsuffix .vglog, $(basename $(notdir $(TESTCASES))))) + +%.vglog: FORCE + @mkdir -p $(builddir)/testo.d + @$(srcdir)/vtesto -l -j $@ $(basename $(notdir $@)) + +# Declaring a target PHONY whose names matches a subdirectory can be +# particularly important, e.g. gui. +.PHONY: all clean check-vtesto + +all: check-vtesto + +clean: + rm -f $(VGLOGS) + +check-vtesto: + @$(MAKE) -f $(srcdir)/Makefile_vtesto $(VGLOGS) + +FORCE: diff --git a/f90g_track.cc b/f90g_track.cc index 90be17faf..1ea72c7a4 100644 --- a/f90g_track.cc +++ b/f90g_track.cc @@ -29,6 +29,7 @@ #include "defs.h" #include "gbfile.h" #include +#include #define MYNAME "f90g_track" #define TTRECORDSIZE 249 @@ -69,7 +70,7 @@ f90g_track_rd_init(const QString& fname) // start the track list track = new route_head; is_fatal((track == nullptr), MYNAME ": memory non-enough"); - track->rte_name = fname; + track->rte_name = QFileInfo(fname).fileName(); track_add_head(track); } } diff --git a/reference/nonexistent.err b/reference/nonexistent.err index 6a9909604..503ad75ac 100644 --- a/reference/nonexistent.err +++ b/reference/nonexistent.err @@ -1 +1 @@ -Cannot open './reference/doesnotexist' for read. Error was 'No such file or directory'. +Cannot open 'doesnotexist' for read. Error was 'No such file or directory'. diff --git a/reference/nonexistent_alternate.err b/reference/nonexistent_alternate.err index 38376665a..2f3890dbb 100644 --- a/reference/nonexistent_alternate.err +++ b/reference/nonexistent_alternate.err @@ -1 +1 @@ -Cannot open './reference/doesnotexist' for read. Error was 'The system cannot find the file specified.'. +Cannot open 'doesnotexist' for read. Error was 'The system cannot find the file specified.'. diff --git a/reference/track/f90g-sample.gpx b/reference/track/f90g-sample.gpx index 12bc43390..1f1a449ee 100644 --- a/reference/track/f90g-sample.gpx +++ b/reference/track/f90g-sample.gpx @@ -3,7 +3,7 @@ - ./reference/track/f90g-sample.map + f90g-sample.map diff --git a/src/core/file.h b/src/core/file.h index 60c5d2c8e..c6cd70d17 100644 --- a/src/core/file.h +++ b/src/core/file.h @@ -21,6 +21,7 @@ #define SRC_CORE_FILE_INCLUDED_H_ #include +#include #include #include #include "defs.h" @@ -51,7 +52,7 @@ class File : public QFile if (!status) { fatal("Cannot open '%s' for %s. Error was '%s'.\n", - qPrintable(QFile::fileName()), + gpsbabel_testmode()? qPrintable(QFileInfo(*this).fileName()) : qPrintable(QFile::fileName()), (mode & QIODevice::WriteOnly)? "write" : "read", qPrintable(QFile::errorString())); } diff --git a/testo b/testo index be5444c0d..b4ff2c502 100755 --- a/testo +++ b/testo @@ -137,14 +137,14 @@ if [ $# -ge 1 ]; then while [ $# -ge 1 ]; do t=${BASEPATH}/testo.d/$1.test - echo Running $t + echo Running `basename $t` . $t shift; done else for i in ${BASEPATH}/testo.d/*.test do - echo Running $i + echo Running `basename $i` . $i done fi diff --git a/testo.d/xol.test b/testo.d/xol.test index b4135a899..94f69450d 100644 --- a/testo.d/xol.test +++ b/testo.d/xol.test @@ -15,10 +15,8 @@ rm -f ${TMPDIR}/xol-sample_si.gpx ${PNAME} -i xol -f ${REFERENCE}/doesnotexist -o gpx -F ${TMPDIR}/xol-sample_si.gpx 2> ${TMPDIR}/nonexistent.err && { echo "${PNAME} succeeded! (it shouldn't have with this input...)" } -# check error message is what we expected -# Note that the reference file nonexistent.err includes the file path, -# so this will fail when starting from a directory other than gpsbabel. -# the message can vary depending on the c runtime, .i.e. msvc and gcc are slightly different. +# check error message is what we expected. +# The message can vary depending on the c runtime, .i.e. msvc and gcc are slightly different. compare_with_alternate ${REFERENCE}/nonexistent.err ${REFERENCE}/nonexistent_alternate.err ${TMPDIR}/nonexistent.err