SQLite

Check-in [7e669d9bfa]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Initial work on porting lsmtest to Win32.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | lsm-vtab
Files: files | file ages | folders
SHA3-256: 7e669d9bfab237ff7ece821cf95cfd3bb753b1882b9a86044b7d4579808aecf4
User & Date: mistachkin 2017-06-27 22:27:54.690
Context
2017-06-27
22:33
Improve a local variable name. (check-in: d0f6973d93 user: mistachkin tags: lsm-vtab)
22:27
Initial work on porting lsmtest to Win32. (check-in: 7e669d9bfa user: mistachkin tags: lsm-vtab)
18:15
Implement xFullpath for lsm1 on Win32. (check-in: dbe9c8aa8d user: mistachkin tags: lsm-vtab)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/lsm1/Makefile.
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
             $(LSMDIR)/lsm-test/lsmtest5.c $(LSMDIR)/lsm-test/lsmtest6.c     \
             $(LSMDIR)/lsm-test/lsmtest7.c $(LSMDIR)/lsm-test/lsmtest8.c     \
             $(LSMDIR)/lsm-test/lsmtest9.c                                   \
             $(LSMDIR)/lsm-test/lsmtest_datasource.c \
             $(LSMDIR)/lsm-test/lsmtest_func.c $(LSMDIR)/lsm-test/lsmtest_io.c  \
             $(LSMDIR)/lsm-test/lsmtest_main.c $(LSMDIR)/lsm-test/lsmtest_mem.c \
             $(LSMDIR)/lsm-test/lsmtest_tdb.c $(LSMDIR)/lsm-test/lsmtest_tdb3.c \
             $(LSMDIR)/lsm-test/lsmtest_util.c


# all: lsm.so

LSMOPTS = -DLSM_MUTEX_PTHREADS=1 -I$(LSMDIR)

lsm.so:	$(LSMOBJ)







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
             $(LSMDIR)/lsm-test/lsmtest5.c $(LSMDIR)/lsm-test/lsmtest6.c     \
             $(LSMDIR)/lsm-test/lsmtest7.c $(LSMDIR)/lsm-test/lsmtest8.c     \
             $(LSMDIR)/lsm-test/lsmtest9.c                                   \
             $(LSMDIR)/lsm-test/lsmtest_datasource.c \
             $(LSMDIR)/lsm-test/lsmtest_func.c $(LSMDIR)/lsm-test/lsmtest_io.c  \
             $(LSMDIR)/lsm-test/lsmtest_main.c $(LSMDIR)/lsm-test/lsmtest_mem.c \
             $(LSMDIR)/lsm-test/lsmtest_tdb.c $(LSMDIR)/lsm-test/lsmtest_tdb3.c \
             $(LSMDIR)/lsm-test/lsmtest_util.c $(LSMDIR)/lsm-test/lsmtest_win32.c


# all: lsm.so

LSMOPTS = -DLSM_MUTEX_PTHREADS=1 -I$(LSMDIR)

lsm.so:	$(LSMOBJ)
Changes to ext/lsm1/Makefile.msc.
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
             $(LSMDIR)\lsm-test\lsmtest5.c $(LSMDIR)\lsm-test\lsmtest6.c     \
             $(LSMDIR)\lsm-test\lsmtest7.c $(LSMDIR)\lsm-test\lsmtest8.c     \
             $(LSMDIR)\lsm-test\lsmtest9.c                                   \
             $(LSMDIR)\lsm-test\lsmtest_datasource.c \
             $(LSMDIR)\lsm-test\lsmtest_func.c $(LSMDIR)\lsm-test\lsmtest_io.c  \
             $(LSMDIR)\lsm-test\lsmtest_main.c $(LSMDIR)\lsm-test\lsmtest_mem.c \
             $(LSMDIR)\lsm-test\lsmtest_tdb.c $(LSMDIR)\lsm-test\lsmtest_tdb3.c \
             $(LSMDIR)\lsm-test\lsmtest_util.c

# all: lsm.dll

LSMOPTS = -DLSM_MUTEX_WIN32=1 -I$(LSMDIR)

lsm_ckpt.lo:	$(LSMDIR)\lsm_ckpt.c $(LSMHDR) $(SQLITE3H)
	$(LTCOMPILE) $(LSMOPTS) -c $(LSMDIR)\lsm_ckpt.c







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
             $(LSMDIR)\lsm-test\lsmtest5.c $(LSMDIR)\lsm-test\lsmtest6.c     \
             $(LSMDIR)\lsm-test\lsmtest7.c $(LSMDIR)\lsm-test\lsmtest8.c     \
             $(LSMDIR)\lsm-test\lsmtest9.c                                   \
             $(LSMDIR)\lsm-test\lsmtest_datasource.c \
             $(LSMDIR)\lsm-test\lsmtest_func.c $(LSMDIR)\lsm-test\lsmtest_io.c  \
             $(LSMDIR)\lsm-test\lsmtest_main.c $(LSMDIR)\lsm-test\lsmtest_mem.c \
             $(LSMDIR)\lsm-test\lsmtest_tdb.c $(LSMDIR)\lsm-test\lsmtest_tdb3.c \
             $(LSMDIR)\lsm-test\lsmtest_util.c $(LSMDIR)\lsm-test\lsmtest_win32.c

# all: lsm.dll

LSMOPTS = -DLSM_MUTEX_WIN32=1 -I$(LSMDIR)

lsm_ckpt.lo:	$(LSMDIR)\lsm_ckpt.c $(LSMHDR) $(SQLITE3H)
	$(LTCOMPILE) $(LSMOPTS) -c $(LSMDIR)\lsm_ckpt.c
85
86
87
88
89
90
91
92
93
lsm_vtab.lo:	$(LSMDIR)\lsm_vtab.c $(LSMHDR) $(SQLITE3H)
	$(LTCOMPILE) $(LSMOPTS) -c $(LSMDIR)\lsm_vtab.c

lsm.dll:	$(LSMOBJ)
	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ $(LSMOBJ)

lsmtest.exe: $(LSMOBJ) $(LSMTESTSRC) $(LSMTESTHDR) $(LIBOBJS1)
	# $(LTCOMPILE) -c $(TOP)\lsm-test\lsmtest_tdb2.cc
	$(LTCOMPILE) $(LSMOPTS) $(LSMTESTSRC) $(LSMOBJ) $(LIBOBJS1) -Fe$@







<
|
85
86
87
88
89
90
91

92
lsm_vtab.lo:	$(LSMDIR)\lsm_vtab.c $(LSMHDR) $(SQLITE3H)
	$(LTCOMPILE) $(LSMOPTS) -c $(LSMDIR)\lsm_vtab.c

lsm.dll:	$(LSMOBJ)
	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ $(LSMOBJ)

lsmtest.exe: $(LSMOBJ) $(LSMTESTSRC) $(LSMTESTHDR) $(LIBOBJS1)

	$(LTLINK) $(LSMOPTS) $(LSMTESTSRC) /link $(LSMOBJ) $(LIBOBJS1)
Changes to ext/lsm1/lsm-test/lsmtest.h.
10
11
12
13
14
15
16



















17
18
19
20
21
22
23
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif




















#ifndef _LSM_INT_H
typedef unsigned int  u32;
typedef unsigned char u8;
typedef long long int i64;
typedef unsigned long long int u64;
#endif







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifdef _WIN32
# include "windows.h"
# define gettimeofday win32GetTimeOfDay
# define F_OK  (0)
# define sleep(sec) Sleep(1000 * (sec))
# define usleep(usec) Sleep((usec) / 1000)
# ifdef _MSC_VER
#  include <io.h>
#  define snprintf _snprintf
#  define fsync(fd) FlushFileBuffers((HANDLE)_get_osfhandle((fd)))
#  define fdatasync(fd) FlushFileBuffers((HANDLE)_get_osfhandle((fd)))
#  define __va_copy(dst,src) ((dst) = (src))
#  define ftruncate(fd,sz) (_chsize_s((fd), (sz))==0)
# else
#  error Unsupported C compiler for Windows.
# endif
int win32GetTimeOfDay(struct timeval *, void *);
#endif

#ifndef _LSM_INT_H
typedef unsigned int  u32;
typedef unsigned char u8;
typedef long long int i64;
typedef unsigned long long int u64;
#endif
Changes to ext/lsm1/lsm-test/lsmtest6.c.
236
237
238
239
240
241
242

243

244
245
246
247
248
249
250
    lsm_csr_close(pCsr);
    *pRc = rc;
  }
}

#define LSMTEST6_TESTDB "testdb.lsm" 


#include <unistd.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

void testDeleteLsmdb(const char *zFile){
  char *zLog = testMallocPrintf("%s-log", zFile);
  char *zShm = testMallocPrintf("%s-shm", zFile);







>
|
>







236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
    lsm_csr_close(pCsr);
    *pRc = rc;
  }
}

#define LSMTEST6_TESTDB "testdb.lsm" 

#ifndef _WIN32
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

void testDeleteLsmdb(const char *zFile){
  char *zLog = testMallocPrintf("%s-log", zFile);
  char *zShm = testMallocPrintf("%s-shm", zFile);
Changes to ext/lsm1/lsm-test/lsmtest_io.c.
54
55
56
57
58
59
60

61

62
63
64
65
66
67
68
*/

#include "lsmtest.h"

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <unistd.h>

#include <ctype.h>

typedef struct IoContext IoContext;

struct IoContext {
  int fd;
  int nWrite;







>
|
>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
*/

#include "lsmtest.h"

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifndef _WIN32
# include <unistd.h>
#endif
#include <ctype.h>

typedef struct IoContext IoContext;

struct IoContext {
  int fd;
  int nWrite;
Changes to ext/lsm1/lsm-test/lsmtest_main.c.
1
2
3
4
5
6
7
8
9
10

11

12
13
14
15
16
17
18

#include "stdarg.h"
#include "lsmtest.h"
#include "stdio.h"
#include "assert.h"
#include "string.h"
#include "stdlib.h"

#include <sqlite3.h>


#include <unistd.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>


void test_failed(){ 










>
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

#include "stdarg.h"
#include "lsmtest.h"
#include "stdio.h"
#include "assert.h"
#include "string.h"
#include "stdlib.h"

#include <sqlite3.h>

#ifndef _WIN32
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>


void test_failed(){ 
Changes to ext/lsm1/lsm-test/lsmtest_tdb.c.
10
11
12
13
14
15
16

17

18
19
20
21
22
23
24
#include "lsm.h"

#include "lsmtest.h"

#include <stdlib.h>
#include <string.h>
#include <assert.h>

#include <unistd.h>

#include <stdio.h>


typedef struct SqlDb SqlDb;

static int error_transaction_function(TestDb *p, int iLevel){ 
  unused_parameter(p);







>
|
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "lsm.h"

#include "lsmtest.h"

#include <stdlib.h>
#include <string.h>
#include <assert.h>
#ifndef _WIN32
# include <unistd.h>
#endif
#include <stdio.h>


typedef struct SqlDb SqlDb;

static int error_transaction_function(TestDb *p, int iLevel){ 
  unused_parameter(p);
Changes to ext/lsm1/lsm-test/lsmtest_tdb3.c.
1
2
3
4
5
6
7
8

9

10
11

12

13
14
15
16
17
18
19

#include "lsmtest_tdb.h"
#include "lsm.h"
#include "lsmtest.h"

#include <stdlib.h>
#include <string.h>
#include <assert.h>

#include <unistd.h>

#include <stdio.h>


#include <sys/time.h>


typedef struct LsmDb LsmDb;
typedef struct LsmWorker LsmWorker;
typedef struct LsmFile LsmFile;

#define LSMTEST_DFLT_MT_MAX_CKPT (8*1024)
#define LSMTEST_DFLT_MT_MIN_CKPT (2*1024)








>
|
>


>
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

#include "lsmtest_tdb.h"
#include "lsm.h"
#include "lsmtest.h"

#include <stdlib.h>
#include <string.h>
#include <assert.h>
#ifndef _WIN32
# include <unistd.h>
#endif
#include <stdio.h>

#ifndef _WIN32
# include <sys/time.h>
#endif

typedef struct LsmDb LsmDb;
typedef struct LsmWorker LsmWorker;
typedef struct LsmFile LsmFile;

#define LSMTEST_DFLT_MT_MAX_CKPT (8*1024)
#define LSMTEST_DFLT_MT_MIN_CKPT (2*1024)
Changes to ext/lsm1/lsm-test/lsmtest_util.c.
1

2
3
4

5

6
7
8
9
10
11
12


#include <stdarg.h>
#include <stdio.h>
#include <string.h>

#include <sys/time.h>


/*
** Global variables used within this module.
*/
static struct TestutilGlobal {
  char **argv;
  int argc;

>



>
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

#include "lsmtest.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#ifndef _WIN32
# include <sys/time.h>
#endif

/*
** Global variables used within this module.
*/
static struct TestutilGlobal {
  char **argv;
  int argc;
Added ext/lsm1/lsm-test/lsmtest_win32.c.




























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

#include "lsmtest.h"

#ifdef _WIN32

#define TICKS_PER_SECOND      (10000000)
#define TICKS_PER_MICROSECOND (10)
#define TICKS_UNIX_EPOCH      (116444736000000000LL)

int win32GetTimeOfDay(
  struct timeval *tp,
  void *tzp
){
  FILETIME fileTime;
  ULARGE_INTEGER largeInteger;
  ULONGLONG temp;

  unused_parameter(tzp);
  memset(&fileTime, 0, sizeof(FILETIME));
  GetSystemTimeAsFileTime(&fileTime);
  memset(&largeInteger, 0, sizeof(ULARGE_INTEGER));
  largeInteger.LowPart = fileTime.dwLowDateTime;
  largeInteger.HighPart = fileTime.dwHighDateTime;
  temp = largeInteger.QuadPart - TICKS_UNIX_EPOCH;
  tp->tv_sec = (long)(temp / TICKS_PER_SECOND);
  temp -= ((ULONGLONG)tp->tv_sec * TICKS_PER_SECOND);
  tp->tv_usec = (long)(temp / TICKS_PER_MICROSECOND);
  return 0;
}
#endif
Changes to ext/lsm1/lsmInt.h.
20
21
22
23
24
25
26

27

28
29
30
31
32
33
34

#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>

#ifdef _WIN32

# define snprintf _snprintf

#else
# include <unistd.h>
#endif

#ifdef NDEBUG
# ifdef LSM_DEBUG_EXPENSIVE
#  undef LSM_DEBUG_EXPENSIVE







>
|
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>

#ifdef _WIN32
# ifdef _MSC_VER
#  define snprintf _snprintf
# endif
#else
# include <unistd.h>
#endif

#ifdef NDEBUG
# ifdef LSM_DEBUG_EXPENSIVE
#  undef LSM_DEBUG_EXPENSIVE