Skip to content

Commit 73bf5d5

Browse files
committed
fix(test): conditionally compile threaded peer test
1 parent 879c23e commit 73bf5d5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/main.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,20 @@
1414
#include "utils.h"
1515
#include "sqlite3.h"
1616

17+
// Define the number of simulated peers, when it's 0 it skips the peer test.
18+
#ifdef __linux__
19+
#define PEERS 0
20+
#else
21+
#define PEERS 5
22+
#endif
23+
24+
#ifdef PEERS
1725
#ifdef _WIN32
1826
#include <windows.h>
1927
#else
2028
#include <pthread.h>
2129
#endif
22-
#define PEERS 5
30+
#endif // PEERS
2331

2432
#ifdef CLOUDSYNC_LOAD_FROM_SOURCES
2533
#include "cloudsync.h"
@@ -319,6 +327,7 @@ int test_report(const char *description, int rc){
319327
return rc;
320328
}
321329

330+
#ifdef PEERS
322331
#ifdef _WIN32
323332
DWORD WINAPI worker(LPVOID arg) {
324333
#else
@@ -342,6 +351,7 @@ void* worker(void* arg) {
342351
return NULL;
343352
#endif
344353
}
354+
#endif // PEERS
345355

346356
int main (void) {
347357
int rc = SQLITE_OK;
@@ -363,6 +373,7 @@ int main (void) {
363373

364374
remove(DB_PATH); // remove the database file
365375

376+
#ifdef PEERS
366377
#ifdef _WIN32
367378
HANDLE threads[PEERS];
368379
#else
@@ -448,6 +459,7 @@ int main (void) {
448459
printf("Threading test failed: %d thread(s) had errors\n", thread_errors);
449460
rc += thread_errors;
450461
}
462+
#endif // PEERS
451463

452464
printf("\n");
453465
return rc;

0 commit comments

Comments
 (0)