Skip to content

Commit a3bae60

Browse files
committed
have pg_regress fall back on testing with the canonical results file if an alternative test is specified but none succeeds.
1 parent 8d5f3c8 commit a3bae60

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/test/regress/pg_regress.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.17 2006/07/30 01:45:21 momjian Exp $
14+
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.18 2006/08/01 14:56:29 adunstan Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -913,6 +913,36 @@ results_differ(const char *testname)
913913
}
914914
}
915915

916+
/*
917+
* fall back on the canonical results file if we haven't tried it yet
918+
* and haven't found a complete match yet.
919+
*/
920+
921+
if (strcmp(expectname, testname) != 0)
922+
{
923+
snprintf(expectfile, sizeof(expectfile), "%s/expected/%s.out",
924+
inputdir, testname, i);
925+
926+
snprintf(cmd, sizeof(cmd),
927+
SYSTEMQUOTE "diff %s \"%s\" \"%s\" > \"%s\"" SYSTEMQUOTE,
928+
basic_diff_opts, expectfile, resultsfile, diff);
929+
930+
if (run_diff(cmd, diff) == 0)
931+
{
932+
/* No diff = no changes = good */
933+
unlink(diff);
934+
return false;
935+
}
936+
937+
l = file_line_count(diff);
938+
if (l < best_line_count)
939+
{
940+
/* This diff was a better match than the last one */
941+
best_line_count = l;
942+
strcpy(best_expect_file, expectfile);
943+
}
944+
}
945+
916946
/*
917947
* Use the best comparison file to generate the "pretty" diff, which
918948
* we append to the diffs summary file.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy