|
|
|
@ -19,11 +19,8 @@ |
|
|
|
|
|
|
|
|
|
// Can not use port/port.h macros as this is a c file
|
|
|
|
|
#ifdef OS_WIN |
|
|
|
|
|
|
|
|
|
#include <windows.h> |
|
|
|
|
|
|
|
|
|
#define snprintf _snprintf |
|
|
|
|
|
|
|
|
|
// Ok for uniqueness
|
|
|
|
|
int geteuid() { |
|
|
|
|
int result = 0; |
|
|
|
@ -34,6 +31,11 @@ int geteuid() { |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// VS < 2015
|
|
|
|
|
#if defined(_MSC_VER) && (_MSC_VER < 1900) |
|
|
|
|
#define snprintf _snprintf |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
const char* phase = ""; |
|
|
|
@ -47,12 +49,19 @@ static void StartPhase(const char* name) { |
|
|
|
|
fprintf(stderr, "=== Test %s\n", name); |
|
|
|
|
phase = name; |
|
|
|
|
} |
|
|
|
|
#ifdef _MSC_VER |
|
|
|
|
#pragma warning(push) |
|
|
|
|
#pragma warning (disable: 4996) // getenv security warning
|
|
|
|
|
#endif |
|
|
|
|
static const char* GetTempDir(void) { |
|
|
|
|
const char* ret = getenv("TEST_TMPDIR"); |
|
|
|
|
if (ret == NULL || ret[0] == '\0') |
|
|
|
|
ret = "/tmp"; |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
#ifdef _MSC_VER |
|
|
|
|
#pragma warning(pop) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#define CheckNoError(err) \ |
|
|
|
|
if ((err) != NULL) { \
|
|
|
|
@ -643,7 +652,7 @@ int main(int argc, char** argv) { |
|
|
|
|
rocksdb_sstfilewriter_t* writer = |
|
|
|
|
rocksdb_sstfilewriter_create(env_opt, io_options); |
|
|
|
|
|
|
|
|
|
unlink(sstfilename); |
|
|
|
|
remove(sstfilename); |
|
|
|
|
rocksdb_sstfilewriter_open(writer, sstfilename, &err); |
|
|
|
|
CheckNoError(err); |
|
|
|
|
rocksdb_sstfilewriter_put(writer, "sstk1", 5, "v1", 2, &err); |
|
|
|
@ -664,7 +673,7 @@ int main(int argc, char** argv) { |
|
|
|
|
CheckGet(db, roptions, "sstk2", "v2"); |
|
|
|
|
CheckGet(db, roptions, "sstk3", "v3"); |
|
|
|
|
|
|
|
|
|
unlink(sstfilename); |
|
|
|
|
remove(sstfilename); |
|
|
|
|
rocksdb_sstfilewriter_open(writer, sstfilename, &err); |
|
|
|
|
CheckNoError(err); |
|
|
|
|
rocksdb_sstfilewriter_put(writer, "sstk2", 5, "v4", 2, &err); |
|
|
|
|