Ticket #440: patch1.patch

File patch1.patch, 2.0 KB (added by Charlie Hull, 15 years ago)

Patch to make xapian-compact tests work on Windows

  • api_compact.cc

     
    3232#include <xapian.h>
    3333
    3434#include <cstdlib>
     35
     36#ifdef __WIN32__
     37#define WEXITSTATUS(w) w
     38#else
    3539#include <sys/wait.h>
     40#endif
    3641
    3742#include "utils.h"
    3843#include "unixcmds.h"
     
    9398    }
    9499}
    95100
     101#ifdef __WIN32__
     102#define XAPIANCOMPACTPATH "..\\win32\\Release\\xapian-compact >nul "
     103#else
     104#define XAPIANCOMPACTPATH "../bin/xapian-compact >/dev/null 2>&1 "
     105#endif
     106
     107
    96108DEFINE_TESTCASE(compactnorenumber1, flint) {
    97109    int status;
    98110
     
    103115                                 "3000 999999 !999999");
    104116    d += ' ';
    105117
    106     string cmd = "../bin/xapian-compact >/dev/null 2>&1 --no-renumber ";
     118    string cmd = XAPIANCOMPACTPATH;
    107119    string out = get_named_writable_database_path("compactnorenumber1out");
    108120
    109121    rm_rf(out);
    110     status = system(cmd + b + out);
     122    status = system(cmd + " --no-renumber " + b + out);
    111123    TEST_EQUAL(WEXITSTATUS(status), 0);
    112124    check_sparse_uid_terms(out);
    113125
    114126    // Should fail for 1.0.x which doesn't support --no-renumber when merging.
    115127    rm_rf(out);
    116     status = system(cmd + b + d + out);
     128    status = system(cmd + " --no-renumber " + b + d + out);
    117129    TEST_NOT_EQUAL(WEXITSTATUS(status), 0);
    118130
    119131    return true;
     
    123135DEFINE_TESTCASE(compactmerge1, flint) {
    124136    int status;
    125137
    126     string cmd = "../bin/xapian-compact >/dev/null 2>&1 ";
     138    string cmd = XAPIANCOMPACTPATH;
    127139    string indbpath = get_database_path("apitest_simpledata") + ' ';
    128140    string outdbpath = get_named_writable_database_path("compactmerge1out");
    129141    rm_rf(outdbpath);
     
    160172DEFINE_TESTCASE(compactmultichunks1, flint) {
    161173    int status;
    162174
    163     string cmd = "../bin/xapian-compact >/dev/null 2>&1 ";
     175    string cmd = XAPIANCOMPACTPATH;
    164176    string indbpath = get_database_path("compactmultichunks1in",
    165177                                        make_multichunk_db, "");
    166178    string outdbpath = get_named_writable_database_path("compactmultichunks1out");