Skip to content

Commit fd957f8

Browse files
committed
tests: adding tests from main repository
1 parent 1a23c42 commit fd957f8

121 files changed

Lines changed: 27340 additions & 846 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.idea/ant.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

core/pom.xml

Lines changed: 21 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
~
2323
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
2424

25-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
25+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
26+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2627
<modelVersion>4.0.0</modelVersion>
2728
<name>QuestDB</name>
2829
<description>QuestDB is high performance SQL time series database</description>
@@ -36,14 +37,6 @@
3637
<argLine>-ea -Dfile.encoding=UTF-8 -XX:+UseParallelGC</argLine>
3738
<test.exclude>None</test.exclude>
3839
<test.include>%regex[.*[^o].class]</test.include><!-- exclude module-info.class-->
39-
<web.console.version>1.1.12</web.console.version>
40-
<qdbr.path>rust/qdbr</qdbr.path>
41-
<qdbr.release>false</qdbr.release>
42-
43-
<!--
44-
For production builds, use -P qdbr-release
45-
-->
46-
<qdbr.rustflags>-D warnings</qdbr.rustflags>
4740
</properties>
4841

4942
<version>9.3.2-SNAPSHOT</version>
@@ -192,20 +185,14 @@
192185
<artifactId>maven-surefire-plugin</artifactId>
193186
<version>3.5.3</version>
194187
<configuration>
195-
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory" />
188+
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
196189
<useModulePath>true</useModulePath>
197190
<includes>
198191
<include>${test.include}</include>
199192
</includes>
200193
<excludes>
201194
<exclude>${test.exclude}</exclude>
202195
</excludes>
203-
<properties>
204-
<property>
205-
<name>listener</name>
206-
<value>io.questdb.test.TestListener</value>
207-
</property>
208-
</properties>
209196
<environmentVariables>
210197
<!-- needed for testing Sender.fromEnv() -->
211198
<QDB_CLIENT_CONF>
@@ -265,6 +252,9 @@
265252
<arch>amd64</arch>
266253
</os>
267254
</activation>
255+
<properties>
256+
<platform.dir.name>linux-x86-64</platform.dir.name>
257+
</properties>
268258
</profile>
269259
<profile>
270260
<id>platform-freebsd-x86-64</id>
@@ -283,6 +273,9 @@
283273
<arch>aarch64</arch>
284274
</os>
285275
</activation>
276+
<properties>
277+
<platform.dir.name>linux-aarch64</platform.dir.name>
278+
</properties>
286279
</profile>
287280
<profile>
288281
<id>platform-osx-x86-64</id>
@@ -292,6 +285,9 @@
292285
<arch>amd64</arch>
293286
</os>
294287
</activation>
288+
<properties>
289+
<platform.dir.name>darwin-x86-64</platform.dir.name>
290+
</properties>
295291
</profile>
296292
<profile>
297293
<id>platform-osx-aarch64</id>
@@ -301,6 +297,9 @@
301297
<arch>aarch64</arch>
302298
</os>
303299
</activation>
300+
<properties>
301+
<platform.dir.name>darwin-aarch64</platform.dir.name>
302+
</properties>
304303
</profile>
305304
<profile>
306305
<id>maven-central-release</id>
@@ -434,60 +433,6 @@
434433
</dependency>
435434
</dependencies>
436435
</profile>
437-
<profile>
438-
<id>qdbr-release</id>
439-
<properties>
440-
<qdbr.release>true</qdbr.release>
441-
</properties>
442-
</profile>
443-
<profile>
444-
<id>qdbr-coverage</id>
445-
<properties>
446-
<qdr.release>false</qdr.release>
447-
<qdbr.rustflags>-D warnings -C instrument-coverage</qdbr.rustflags>
448-
</properties>
449-
<build>
450-
<plugins>
451-
<plugin>
452-
<groupId>org.questdb</groupId>
453-
<artifactId>rust-maven-plugin</artifactId>
454-
<version>1.2.0</version>
455-
<executions>
456-
<execution>
457-
<id>qdbr-build</id>
458-
<goals>
459-
<goal>build</goal>
460-
</goals>
461-
<configuration>
462-
<path>rust/qdbr</path>
463-
<release>${qdbr.release}</release>
464-
<copyTo>${project.build.directory}/classes/io/questdb/bin</copyTo>
465-
<copyWithPlatformDir>true</copyWithPlatformDir>
466-
<environmentVariables>
467-
<RUSTFLAGS>${qdbr.rustflags}</RUSTFLAGS>
468-
</environmentVariables>
469-
</configuration>
470-
</execution>
471-
<execution>
472-
<id>qdbr-test</id>
473-
<goals>
474-
<goal>test</goal>
475-
</goals>
476-
<phase>test</phase>
477-
<configuration>
478-
<path>rust/qdbr</path>
479-
<release>${qdbr.release}</release>
480-
<environmentVariables>
481-
<RUSTFLAGS>${qdbr.rustflags}</RUSTFLAGS>
482-
<LLVM_PROFILE_FILE>questdbr-cargo-test.profraw</LLVM_PROFILE_FILE>
483-
</environmentVariables>
484-
</configuration>
485-
</execution>
486-
</executions>
487-
</plugin>
488-
</plugins>
489-
</build>
490-
</profile>
491436
</profiles>
492437

493438
<dependencies>
@@ -498,5 +443,11 @@
498443
<version>4.13.2</version>
499444
<scope>test</scope>
500445
</dependency>
446+
<dependency>
447+
<groupId>org.postgresql</groupId>
448+
<artifactId>postgresql</artifactId>
449+
<version>42.7.9</version>
450+
<scope>test</scope>
451+
</dependency>
501452
</dependencies>
502453
</project>

core/src/main/c/share/net.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,38 @@ JNIEXPORT jlong JNICALL Java_io_questdb_network_Net_getAddrInfo0
322322
}
323323
return -1;
324324
}
325+
326+
JNIEXPORT jint JNICALL Java_io_questdb_network_Net_socketUdp
327+
(JNIEnv *e, jclass cl) {
328+
int fd = socket(AF_INET, SOCK_DGRAM, 0);
329+
330+
if (fd > 0 && fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
331+
close(fd);
332+
return -1;
333+
}
334+
335+
return fd;
336+
}
337+
338+
JNIEXPORT jint JNICALL Java_io_questdb_network_Net_setMulticastInterface
339+
(JNIEnv *e, jclass cl, jint fd, jint ipv4address) {
340+
struct in_addr address;
341+
address.s_addr = (in_addr_t) htonl((__uint32_t) ipv4address);
342+
return setsockopt((int) fd, IPPROTO_IP, IP_MULTICAST_IF, &address, sizeof(address));
343+
}
344+
345+
JNIEXPORT jint JNICALL Java_io_questdb_network_Net_setMulticastTtl
346+
(JNIEnv *e, jclass cl, jint fd, jint ttl) {
347+
u_char lTTL = ttl;
348+
int result = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (char *) &lTTL, sizeof(lTTL));
349+
if (result == 0) {
350+
return result;
351+
}
352+
return -1;
353+
}
354+
355+
JNIEXPORT jint JNICALL Java_io_questdb_network_Net_sendTo
356+
(JNIEnv *e, jclass cl, jint fd, jlong ptr, jint len, jlong sockaddr) {
357+
return (jint) sendto((int) fd, (const void *) ptr, (size_t) len, 0, (const struct sockaddr *) sockaddr,
358+
sizeof(struct sockaddr_in));
359+
}

core/src/main/c/share/net.h

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/main/c/windows/net.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,50 @@ JNIEXPORT jint JNICALL Java_io_questdb_network_Net_setTcpNoDelay
241241
(JNIEnv *e, jclass cl, jint fd, jboolean noDelay) {
242242
return set_int_sockopt((SOCKET) fd, IPPROTO_TCP, TCP_NODELAY, noDelay);
243243
}
244+
245+
JNIEXPORT jint JNICALL Java_io_questdb_network_Net_socketUdp
246+
(JNIEnv *e, jclass cl) {
247+
SOCKET s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
248+
if (s == INVALID_SOCKET) {
249+
return -1;
250+
}
251+
252+
u_long mode = 1;
253+
if (ioctlsocket(s, FIONBIO, &mode) != 0) {
254+
SaveLastError();
255+
closesocket(s);
256+
return -1;
257+
}
258+
return (jint) s;
259+
}
260+
261+
JNIEXPORT jint JNICALL Java_io_questdb_network_Net_setMulticastInterface
262+
(JNIEnv *e, jclass cl, jint fd, jint ipv4address) {
263+
struct in_addr address;
264+
address.s_addr = htonl((u_long) ipv4address);
265+
int result = setsockopt((SOCKET) fd, IPPROTO_IP, IP_MULTICAST_IF, (const char *) &address, sizeof(address));
266+
if (result == SOCKET_ERROR) {
267+
SaveLastError();
268+
}
269+
return result;
270+
}
271+
272+
JNIEXPORT jint JNICALL Java_io_questdb_network_Net_setMulticastTtl
273+
(JNIEnv *e, jclass cl, jint fd, jint ttl) {
274+
DWORD lTTL = ttl;
275+
int result = setsockopt((SOCKET) fd, IPPROTO_IP, IP_MULTICAST_TTL, (char *) &lTTL, sizeof(lTTL));
276+
if (result == SOCKET_ERROR) {
277+
SaveLastError();
278+
}
279+
return result;
280+
}
281+
282+
JNIEXPORT jint JNICALL Java_io_questdb_network_Net_sendTo
283+
(JNIEnv *e, jclass cl, jint fd, jlong ptr, jint len, jlong sockaddr) {
284+
int result = sendto((SOCKET) fd, (const void *) ptr, len, 0, (const struct sockaddr *) sockaddr,
285+
sizeof(struct sockaddr_in));
286+
if (result != len) {
287+
SaveLastError();
288+
}
289+
return result;
290+
}

0 commit comments

Comments
 (0)