Skip to content

Commit

Permalink
support parallel vtesto from qmake. (GPSBabel#612)
Browse files Browse the repository at this point in the history
* support parallel vtesto from qmake.

also support testo, vtesto with out of source builds.

* force check to run.
  • Loading branch information
tsteven4 authored Jul 27, 2020
1 parent d0b73a0 commit e64c6dc
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 16 deletions.
13 changes: 8 additions & 5 deletions GPSBabel.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
34 changes: 34 additions & 0 deletions Makefile_vtesto
Original file line number Diff line number Diff line change
@@ -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:
3 changes: 2 additions & 1 deletion f90g_track.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "defs.h"
#include "gbfile.h"
#include <QtCore/QDebug>
#include <QtCore/QFileInfo>

#define MYNAME "f90g_track"
#define TTRECORDSIZE 249
Expand Down Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion reference/nonexistent.err
Original file line number Diff line number Diff line change
@@ -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'.
2 changes: 1 addition & 1 deletion reference/nonexistent_alternate.err
Original file line number Diff line number Diff line change
@@ -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.'.
2 changes: 1 addition & 1 deletion reference/track/f90g-sample.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<time>1970-01-01T00:00:00Z</time>
<bounds minlat="40.804915000" minlon="-124.126895000" maxlat="40.847798333" maxlon="-124.082008333"/>
<trk>
<name>./reference/track/f90g-sample.map</name>
<name>f90g-sample.map</name>
<trkseg>
<trkpt lat="40.847798333" lon="-124.082008333">
<time>2014-04-27T17:39:52Z</time>
Expand Down
3 changes: 2 additions & 1 deletion src/core/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define SRC_CORE_FILE_INCLUDED_H_

#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QIODevice>
#include <cstdio>
#include "defs.h"
Expand Down Expand Up @@ -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()));
}
Expand Down
4 changes: 2 additions & 2 deletions testo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions testo.d/xol.test
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit e64c6dc

Please sign in to comment.