diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-02-06 22:00:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-06 22:00:31 +0100 |
| commit | 4cd6fe1369f52bc53c8e595a218bd0e7426b05db (patch) | |
| tree | f4227949889ed1520f949713ef610f6e4bcb4a4f | |
| parent | 39aa3b586ca9378b02a65ef0db291a77afa565c9 (diff) | |
| parent | 23f8fb8835015f57ec6debb33c376628419cc5cd (diff) | |
| download | PROJ-4cd6fe1369f52bc53c8e595a218bd0e7426b05db.tar.gz PROJ-4cd6fe1369f52bc53c8e595a218bd0e7426b05db.zip | |
Merge pull request #776 from kbevers/gie_skip_errors
Let gie skip tests when specific errors are returned.
| -rw-r--r-- | src/gie.c | 54 | ||||
| -rw-r--r-- | src/pj_malloc.c | 2 | ||||
| -rw-r--r-- | test/gie/4D-API_cs2cs-style.gie | 8 | ||||
| -rw-r--r-- | test/gie/Makefile.am | 18 | ||||
| -rw-r--r-- | test/gie/deformation.gie | 2 | ||||
| -rw-r--r-- | test/gie/more_builtins.gie | 2 | ||||
| -rw-r--r-- | test/gigs/Makefile.am | 36 |
7 files changed, 83 insertions, 39 deletions
@@ -146,7 +146,7 @@ static ffio *ffio_create (const char **tags, size_t n_tags, size_t max_record_si static const char *gie_tags[] = { "<gie>", "operation", "accept", "expect", "roundtrip", "banner", "verbose", - "direction", "tolerance", "builtins", "echo", "</gie>" + "direction", "tolerance", "ignore", "builtins", "echo", "</gie>" }; static const size_t n_gie_tags = sizeof gie_tags / sizeof gie_tags[0]; @@ -178,12 +178,13 @@ typedef struct { PJ_DIRECTION dir; int verbosity; int op_id; - int op_ok, op_ko; - int total_ok, total_ko; - int grand_ok, grand_ko; + int op_ok, op_ko, op_skip; + int total_ok, total_ko, total_skip; + int grand_ok, grand_ko, grand_skip; size_t operation_lineno; size_t dimensions_given, dimensions_given_at_last_accept; double tolerance; + int ignore; const char *curr_file; FILE *fout; } gie_ctx; @@ -237,6 +238,7 @@ int main (int argc, char **argv) { T.dir = PJ_FWD; T.verbosity = 1; T.tolerance = 5e-4; + T.ignore = 5555; /* Error code that will not be issued by proj_create() */ o = opt_parse (argc, argv, "hlvq", "o", longflags, longkeys); if (0==o) @@ -294,7 +296,8 @@ int main (int argc, char **argv) { if (T.verbosity > 0) { if (o->fargc > 1) - fprintf (T.fout, "%sGrand total: %d. Success: %d, Failure: %d\n", delim, T.grand_ok+T.grand_ko, T.grand_ok, T.grand_ko); + fprintf (T.fout, "%sGrand total: %d. Success: %d, Skipped: %d, Failure: %d\n", + delim, T.grand_ok+T.grand_ko+T.grand_skip, T.grand_ok, T.grand_skip, T.grand_ko); fprintf (T.fout, "%s", delim); } else @@ -315,6 +318,12 @@ static int another_failure (void) { return 0; } +static int another_skip (void) { + T.op_skip++; + T.total_skip++; + return 0; +} + static int another_success (void) { T.op_ok++; T.total_ok++; @@ -328,6 +337,7 @@ static int process_file (const char *fname) { F->lineno = F->next_lineno = F->level = 0; T.op_ok = T.total_ok = 0; T.op_ko = T.total_ko = 0; + T.op_skip = T.total_skip = 0; f = fopen (fname, "rt"); if (0==f) { @@ -351,10 +361,12 @@ static int process_file (const char *fname) { fclose (f); F->lineno = F->next_lineno = 0; - T.grand_ok += T.total_ok; - T.grand_ko += T.total_ko; + T.grand_ok += T.total_ok; + T.grand_ko += T.total_ko; + T.grand_skip += T.grand_skip; if (T.verbosity > 0) - fprintf (T.fout, "%stotal: %2d tests succeeded, %2d tests %s\n", delim, T.total_ok, T.total_ko, T.total_ko? "FAILED!": "failed."); + fprintf (T.fout, "%stotal: %2d tests succeeded, %2d tests skipped, %2d tests %s\n", + delim, T.total_ok, T.total_skip, T.total_ko, T.total_ko? "FAILED!": "failed."); if (F->level==0) return errmsg (-3, "File '%s':Missing '<gie>' cmnd - bye!\n", fname); @@ -441,6 +453,10 @@ static int tolerance (const char *args) { return 0; } +static int ignore (const char *args) { + T.ignore = errno_from_err_const (column (args, 1)); + return 0; +} static int direction (const char *args) { const char *endp = args; @@ -467,7 +483,8 @@ static int direction (const char *args) { static void finish_previous_operation (const char *args) { if (T.verbosity > 1 && T.op_id > 1 && T.op_ok+T.op_ko) - fprintf (T.fout, "%s %d tests succeeded, %d tests %s\n", delim, T.op_ok, T.op_ko, T.op_ko? "FAILED!": "failed."); + fprintf (T.fout, "%s %d tests succeeded, %d tests skipped, %d tests %s\n", + delim, T.op_ok, T.op_skip, T.op_ko, T.op_ko? "FAILED!": "failed."); (void) args; } @@ -494,9 +511,11 @@ either a conversion or a transformation) T.op_ok = 0; T.op_ko = 0; + T.op_skip = 0; direction ("forward"); tolerance ("0.5 mm"); + ignore ("pjd_err_dont_skip"); proj_errno_reset (T.P); @@ -533,6 +552,7 @@ using the "builtins" command verb. } T.op_ok = 0; T.op_ko = 0; + T.op_skip = 0; i = pj_unitconvert_selftest (); if (i!=0) { fprintf (T.fout, "pj_unitconvert_selftest fails with %d\n", i); @@ -637,8 +657,12 @@ back/forward transformation pairs. char *endp; PJ_COORD coo; - if (0==T.P) + if (0==T.P) { + if (T.ignore == proj_errno(T.P)) + return another_skip(); + return another_failure (); + } ans = proj_strtod (args, &endp); ntrips = (int) (endp==args? 100: fabs(ans)); @@ -745,12 +769,16 @@ Tell GIE what to expect, when transforming the ACCEPTed input expect_failure_with_errno = errno_from_err_const (column (args, 3)); } + if (T.ignore==proj_errno(T.P)) + return another_skip (); + if (0==T.P) { /* If we expect failure, and fail, then it's a success... */ if (expect_failure) { /* Failed to fail correctly? */ if (expect_failure_with_errno && proj_errno (T.P)!=expect_failure_with_errno) return expect_failure_with_errno_message (expect_failure_with_errno, proj_errno(T.P)); + return another_success (); } @@ -881,6 +909,7 @@ static int dispatch (const char *cmnd, const char *args) { if (0==strcmp (cmnd, "verbose")) return verbose (args); if (0==strcmp (cmnd, "direction")) return direction (args); if (0==strcmp (cmnd, "tolerance")) return tolerance (args); + if (0==strcmp (cmnd, "ignore")) return ignore (args); if (0==strcmp (cmnd, "builtins")) return builtins (args); if (0==strcmp (cmnd, "echo")) return echo (args); @@ -950,6 +979,7 @@ static const struct errno_vs_err_const lookup[] = { {"pjd_err_ellipsoidal_unsupported" , -56}, {"pjd_err_too_many_inits" , -57}, {"pjd_err_invalid_arg" , -58}, + {"pjd_err_dont_skip" , 5555}, {"pjd_err_unknown" , 9999}, {"pjd_err_enomem" , ENOMEM}, }; @@ -1709,9 +1739,9 @@ static int pj_cart_selftest (void) { proj_destroy(P); /* proj_grid_info() */ - grid_info = proj_grid_info("egm96_15.gtx"); + grid_info = proj_grid_info("null"); if ( strlen(grid_info.filename) == 0 ) return 64; - if ( strcmp(grid_info.gridname, "egm96_15.gtx") ) return 65; + if ( strcmp(grid_info.gridname, "null") ) return 65; grid_info = proj_grid_info("nonexistinggrid"); if ( strlen(grid_info.filename) > 0 ) return 66; diff --git a/src/pj_malloc.c b/src/pj_malloc.c index cfb7f658..73a60599 100644 --- a/src/pj_malloc.c +++ b/src/pj_malloc.c @@ -182,7 +182,7 @@ void pj_free(PJ *P) { /* to be called as the last step of the local destructor */ /* pointed to by P->destructor. In most cases, */ /* pj_default_destructor actually *is* what is pointed to */ - P->destructor (P, 0); + P->destructor (P, proj_errno(P)); } diff --git a/test/gie/4D-API_cs2cs-style.gie b/test/gie/4D-API_cs2cs-style.gie index 853df993..edd83882 100644 --- a/test/gie/4D-API_cs2cs-style.gie +++ b/test/gie/4D-API_cs2cs-style.gie @@ -74,6 +74,7 @@ operation proj=latlong ellps=intl operation proj=latlong nadgrids=nzgd2kgrid0005.gsb ellps=GRS80 ------------------------------------------------------------------------------- tolerance 1 nm +ignore pjd_err_failed_to_load_grid accept 173 -45 0 0 expect 172.999892181021551 -45.001620431954613 0 0 direction inverse @@ -87,6 +88,7 @@ expect 173 -45 0 0 operation proj=latlong geoidgrids=egm96_15.gtx ellps=GRS80 ------------------------------------------------------------------------------- tolerance 15 cm # lax tolerance due to widespread bad egm96 file +ignore pjd_err_failed_to_load_grid accept 12.5 55.5 0 expect 12.5 55.5 -36.0213 direction inverse @@ -96,6 +98,7 @@ expect 12.5 55.5 0 operation proj=merc geoidgrids=egm96_15.gtx ellps=GRS80 ------------------------------------------------------------------------------- tolerance 0.1 mm +ignore pjd_err_failed_to_load_grid accept 12.5 55.5 0 expect 1391493.63492 7424275.19462 -36.0213 direction inverse @@ -111,6 +114,7 @@ Same as the two above, but also do axis swapping. operation proj=latlong geoidgrids=egm96_15.gtx axis=neu ellps=GRS80 ------------------------------------------------------------------------------- tolerance 15 cm # lax tolerance due to widely distributed, bad egm96 file +ignore pjd_err_failed_to_load_grid accept 12.5 55.5 0 expect 55.5 12.5 -36.0213 direction inverse @@ -120,6 +124,7 @@ expect 12.5 55.5 0 operation proj=latlong geoidgrids=egm96_15.gtx axis=dne ellps=GRS80 ------------------------------------------------------------------------------- tolerance 15 cm # lax tolerance due to widely distributed, bad egm96 file +ignore pjd_err_failed_to_load_grid accept 12.5 55.5 0 expect 36.0213 55.5 12.5 direction inverse @@ -129,6 +134,7 @@ expect 12.5 55.5 0 operation proj=merc geoidgrids=egm96_15.gtx ellps=GRS80 ------------------------------------------------------------------------------- tolerance 0.1 mm +ignore pjd_err_failed_to_load_grid accept 12.5 55.5 0 expect 1391493.63492 7424275.19462 -36.0213 direction inverse @@ -143,6 +149,7 @@ Some more complex axis swapping. operation proj=latlong geoidgrids=egm96_15.gtx axis=nue ellps=GRS80 ------------------------------------------------------------------------------- tolerance 15 cm # lax tolerance due to widely distributed, bad egm96 file +ignore pjd_err_failed_to_load_grid accept 12.5 55.5 0 expect 55.5 -36.0213 12.5 direction inverse @@ -152,6 +159,7 @@ expect 12.5 55.5 0 operation proj=merc geoidgrids=egm96_15.gtx axis=sue ellps=GRS80 ------------------------------------------------------------------------------- tolerance 15 cm +ignore pjd_err_failed_to_load_grid accept 12.5 55.5 0 expect -7424275.1946 -36.0213 1391493.6349 0.0000 direction inverse diff --git a/test/gie/Makefile.am b/test/gie/Makefile.am index 72ecd990..4d5b206d 100644 --- a/test/gie/Makefile.am +++ b/test/gie/Makefile.am @@ -10,28 +10,30 @@ EXTRA_DIST = 4D-API_cs2cs-style.gie \ more_builtins.gie \ unitconvert.gie +PROJ_LIB ?= $(top_srcdir)/nad + 4D-API-cs2cs-style: 4D-API_cs2cs-style.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< GDA: GDA.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< axisswap: axisswap.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< builtins: builtins.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< deformation: deformation.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< ellipsoid: ellipsoid.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< more_builtins: more_builtins.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< unitconvert: unitconvert.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< check-local: 4D-API-cs2cs-style GDA axisswap builtins deformation ellipsoid more_builtins unitconvert diff --git a/test/gie/deformation.gie b/test/gie/deformation.gie index 8f0f0caf..55283b84 100644 --- a/test/gie/deformation.gie +++ b/test/gie/deformation.gie @@ -18,6 +18,7 @@ operation +proj=deformation +xy_grids=alaska +z_grids=egm96_15.gtx +t_epoch=2016.0 +t_obs=2000.0 +ellps=GRS80 ------------------------------------------------------------------------------- tolerance 0.1 mm +ignore pjd_err_failed_to_load_grid accept -3004295.5882503074 -1093474.1690603832 5500477.1338251457 expect -3004295.7025 -1093474.2106 5500477.3444 roundtrip 5 @@ -29,6 +30,7 @@ operation +proj=deformation +xy_grids=alaska +z_grids=egm96_15.gtx +t_epoch=2016.0 +ellps=GRS80 ------------------------------------------------------------------------------- tolerance 0.1 mm +ignore pjd_err_failed_to_load_grid accept -3004295.5882503074 -1093474.1690603832 5500477.1338251457 2000.0 expect -3004295.7025 -1093474.2106 5500477.3444 2000.0 roundtrip 5 diff --git a/test/gie/more_builtins.gie b/test/gie/more_builtins.gie index e21f0321..e1c026ea 100644 --- a/test/gie/more_builtins.gie +++ b/test/gie/more_builtins.gie @@ -190,6 +190,7 @@ This is annoying, but must be handled elsewhere. We jump through the hoop by setting a very lax tolerance. ------------------------------------------------------------------------------- tolerance 15 cm +ignore pjd_err_failed_to_load_grid accept 12.5 55.5 0 0 expect 12.5 55.5 -36.021305084228516 0 @@ -214,6 +215,7 @@ Some tests from PJ_hgridshift.c operation proj=hgridshift +grids=nzgd2kgrid0005.gsb ellps=GRS80 ------------------------------------------------------------------------------- tolerance 1 nm +ignore pjd_err_failed_to_load_grid accept 173 -45 0 0 roundtrip 100 ------------------------------------------------------------------------------- diff --git a/test/gigs/Makefile.am b/test/gigs/Makefile.am index ed93daba..25f7d141 100644 --- a/test/gigs/Makefile.am +++ b/test/gigs/Makefile.am @@ -20,57 +20,57 @@ EXTRA_DIST = \ 5201.gie \ 5208.gie +PROJ_LIB ?= $(top_srcdir)/nad 5101.1: 5101.1-jhs.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5101.2: 5101.2-jhs.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5101.3: 5101.3-jhs.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5101.4: 5101.4-jhs-etmerc.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5102.1: 5102.1.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5103.1: 5103.1.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5103.2: 5103.2.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5103.3: 5103.3.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5105.2: 5105.2.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5106: 5106.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5107: 5107.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5109: 5109.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5111.1: 5111.1.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5112: 5112.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5113: 5113.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5201: 5201.gie - $(GIEEXE) $< + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< 5208: 5208.gie - $(GIEEXE) $< - + PROJ_LIB=$(PROJ_LIB) $(GIEEXE) $< check-local: 5101.1 5101.2 5101.3 5101.4 5102.1 5103.1 5103.2 5103.3 5105.2 5106 5107 5109 5111.1 5112 5113 5201 5208 |
