Move src/*.exe to exe/*.exe on Windows.
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Tue, 5 Jul 2016 23:35:42 +0000 (08:35 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Mon, 11 Jul 2016 22:40:58 +0000 (07:40 +0900)
Also use fc command instead of diff command on Windows.
Fix a compilation error in large-object-data-at-exec-test.c regarding a type declaration in the middle of a code block (Patch by Michael Paquier).

test/runsuite.c
test/src/large-object-data-at-exec-test.c
test/win.mak

index 583cf35f5301ccda2c741f0d8e627ace81993352..fe873be63cd3e9c81875aaf37b25495372ed8e2a 100644 (file)
@@ -195,6 +195,8 @@ rundiff(const char *testname, const char *inputdir)
    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);
@@ -243,13 +245,40 @@ rundiff(const char *testname, const char *inputdir)
     * 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;
 }
 
 
index 6ef09de1a2a145c368611f6af61e6999fdb91f8f..e533f1ce61de07f9f3e6be5683af602cf39ca0f9 100644 (file)
@@ -58,11 +58,12 @@ do_test(HSTMT hstmt, int testno, int lobByteSize, char *lobData)
        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 */
index 5e3858f77c1e0cad22f90575e67f34988e343683..ba0063f4e255a3507dabd2d97a6c3d126586a85a 100644 (file)
@@ -19,6 +19,9 @@
 # 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
@@ -31,7 +34,7 @@ TESTS = $(TESTS:-test=)
 
 # exe\<testname>.exe
 TESTEXES = $(TESTBINS:-test=-test.exe)
-TESTEXES = $(TESTEXES:exe/=exe\)
+TESTEXES = $(TESTEXES:/=\)
 
 
 # Flags
@@ -45,10 +48,15 @@ LINKFLAGS=/link odbc32.lib odbccp32.lib
 # 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)
@@ -60,11 +68,15 @@ reset-db.exe: reset-db.c
 .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