|
11 | 11 | * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
12 | 12 | * Portions Copyright (c) 1994, Regents of the University of California
|
13 | 13 | *
|
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 $ |
15 | 15 | *
|
16 | 16 | *-------------------------------------------------------------------------
|
17 | 17 | */
|
@@ -913,6 +913,36 @@ results_differ(const char *testname)
|
913 | 913 | }
|
914 | 914 | }
|
915 | 915 |
|
| 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 | + |
916 | 946 | /*
|
917 | 947 | * Use the best comparison file to generate the "pretty" diff, which
|
918 | 948 | * we append to the diffs summary file.
|
|