int outputno;
char *result;
size_t result_len;
+ static int diff_call = 1, first_call = 1;
+ int diff_rtn;
snprintf(filename, sizeof(filename), "results/%s.out", testname);
result = slurpfile(filename, &result_len);
* expected output file. Perhaps we should run it against all output
* files and print the smallest diff?
*/
+#ifndef WIN32
snprintf(cmdline, sizeof(cmdline),
"diff -c %s/expected/%s.out results/%s.out >> regression.diffs",
inputdir, testname, testname);
- if (system(cmdline) == -1)
+#else
+ if (first_call)
+ {
+ /*
+ * test diff the same file
+ */
+ snprintf(cmdline, sizeof(cmdline),
+ "diff -c --strip-trailing-cr results\\%s.out results\\%s.out",
+ testname, testname);
+ first_call = 0;
+ /*
+ * If diff command exists, the system function would
+ * return 0.
+ */
+ if (system(cmdline) != 0)
+ diff_call = 0;
+ }
+ if (diff_call)
+ snprintf(cmdline, sizeof(cmdline),
+ "diff -c --strip-trailing-cr %s\\expected\\%s.out results\\%s.out >> regression.diffs",
+ inputdir, testname, testname);
+ else /* use fc command instead */
+ snprintf(cmdline, sizeof(cmdline),
+ "fc /N %s\\expected\\%s.out results\\%s.out >> regression.diffs",
+ inputdir, testname, testname);
+#endif
+ if ((diff_rtn = system(cmdline)) == -1)
printf("# diff failed\n");
- return 1;
+ return diff_rtn;
}
SQLLEN lobChunkSize = 4096;
SQLPOINTER pParamId = 0;
const char *what = 0;
+ int error;
/* Get the parameter that needs data */
what = "SQLParamData failed (first call)";
rc = SQLParamData(hstmt, &pParamId);
- int error = SQL_SUCCESS != rc && SQL_SUCCESS_WITH_INFO != rc && SQL_NEED_DATA != rc;
+ error = SQL_SUCCESS != rc && SQL_SUCCESS_WITH_INFO != rc && SQL_NEED_DATA != rc;
if (SQL_NEED_DATA == rc)
{
/* Send parameter data in chunks */
# Include the list of tests
!INCLUDE tests
+SRCDIR=src
+OBJDIR=exe
+
# The 'tests' file contains names of the test programs, in form
# exe/<testname>-test. Extract the base names of the tests, by stripping the
# "exe/" prefix and "-test" suffix. (It would seem more straightforward to do
# exe\<testname>.exe
TESTEXES = $(TESTBINS:-test=-test.exe)
-TESTEXES = $(TESTEXES:exe/=exe\)
+TESTEXES = $(TESTEXES:/=\)
# Flags
# we fail to notice if common.c changes. Also, we build common.c separately
# for each test - ideally we would build common.obj once and just link it
# to each test.
-.c.exe:
- cl /Fe.\exe\ /Fo.\exe\ $*.c src/common.c $(CLFLAGS) $(LINKFLAGS)
+{$(SRCDIR)\}.c{$(OBJDIR)\}.exe:
+ $(CC) /Fe.\$(OBJDIR)\ /Fo.\$(OBJDIR)\ $< $(SRCDIR)\common.c $(CLFLAGS) $(LINKFLAGS)
+
+all: $(OBJDIR) $(TESTEXES) runsuite.exe
-all: $(TESTEXES) runsuite.exe
+$(OBJDIR) :
+!IF !EXIST($(OBJDIR))
+ mkdir $(OBJDIR)
+!ENDIF
runsuite.exe: runsuite.c
cl runsuite.c $(CLFLAGS) $(LINKFLAGS)
.SUFFIXES: .out
# Run regression tests
-installcheck: runsuite.exe $(TESTEXES) reset-db.exe
+RESDIR=results
+installcheck: $(OBJDIR) runsuite.exe $(TESTEXES) reset-db.exe
del regression.diffs
.\reset-db < sampletables.sql
+!IF !EXIST($(RESDIR))
+ mkdir $(RESDIR)
+!ENDIF
.\runsuite $(TESTS)
clean:
- -del exe\*.exe
- -del exe\*.obj
+ -del $(OBJDIR)\*.exe
+ -del $(OBJDIR)\*.obj