aboutsummaryrefslogtreecommitdiff
path: root/tests/sockets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sockets')
-rw-r--r--tests/sockets/test_enet_client.c10
-rw-r--r--tests/sockets/test_enet_server.c8
-rw-r--r--tests/sockets/test_getaddrinfo.c2
-rw-r--r--tests/sockets/test_gethostbyname.c2
-rw-r--r--tests/sockets/test_getnameinfo.c4
-rw-r--r--tests/sockets/test_sockets_echo_client.c6
-rw-r--r--tests/sockets/test_sockets_echo_server.c4
-rw-r--r--tests/sockets/test_sockets_partial_client.c6
-rw-r--r--tests/sockets/test_sockets_partial_server.c4
-rw-r--r--tests/sockets/test_sockets_select_server_closes_connection_client_rw.c6
-rw-r--r--tests/sockets/test_sockets_select_server_down_client.c6
-rw-r--r--tests/sockets/test_sockets_select_server_down_server.c4
-rw-r--r--tests/sockets/webrtc_host.c6
-rw-r--r--tests/sockets/webrtc_peer.c4
14 files changed, 36 insertions, 36 deletions
diff --git a/tests/sockets/test_enet_client.c b/tests/sockets/test_enet_client.c
index afcdcae8..b422e70c 100644
--- a/tests/sockets/test_enet_client.c
+++ b/tests/sockets/test_enet_client.c
@@ -1,14 +1,14 @@
#include <stdio.h>
#include <string.h>
#include <enet/enet.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
ENetHost * host;
void main_loop() {
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
static int counter = 0;
counter++;
if (counter == 100) {
@@ -34,7 +34,7 @@ void main_loop() {
event.channelID);
int result = strcmp("packetfoo", event.packet->data);
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
REPORT_RESULT();
#else
exit(EXIT_SUCCESS);
@@ -92,7 +92,7 @@ int main (int argc, char ** argv)
exit (EXIT_FAILURE);
}
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#if USE_IFRAME
emscripten_run_script("console.log('adding iframe');"
"var iframe = document.createElement('iframe');"
@@ -104,7 +104,7 @@ int main (int argc, char ** argv)
#endif
#endif
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(main_loop, 3, 1);
#else
while (1) main_loop();
diff --git a/tests/sockets/test_enet_server.c b/tests/sockets/test_enet_server.c
index 9a4518ac..30d86a99 100644
--- a/tests/sockets/test_enet_server.c
+++ b/tests/sockets/test_enet_server.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <enet/enet.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -29,12 +29,12 @@ void send_msg(ENetPeer *peer) {
void main_loop() {
static int counter = 0;
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
counter++;
#endif
if (counter == 100) {
printf("stop!\n");
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_cancel_main_loop();
#endif
return;
@@ -101,7 +101,7 @@ int main (int argc, char ** argv)
exit (EXIT_FAILURE);
}
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(main_loop, 3, 1);
#else
while (1) main_loop();
diff --git a/tests/sockets/test_getaddrinfo.c b/tests/sockets/test_getaddrinfo.c
index 1f912c69..85610473 100644
--- a/tests/sockets/test_getaddrinfo.c
+++ b/tests/sockets/test_getaddrinfo.c
@@ -6,7 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
diff --git a/tests/sockets/test_gethostbyname.c b/tests/sockets/test_gethostbyname.c
index 459c6b98..c0e11efb 100644
--- a/tests/sockets/test_gethostbyname.c
+++ b/tests/sockets/test_gethostbyname.c
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
diff --git a/tests/sockets/test_getnameinfo.c b/tests/sockets/test_getnameinfo.c
index c3fec6b4..dd4a0419 100644
--- a/tests/sockets/test_getnameinfo.c
+++ b/tests/sockets/test_getnameinfo.c
@@ -6,7 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -98,4 +98,4 @@ int main() {
puts("success");
return EXIT_SUCCESS;
-} \ No newline at end of file
+}
diff --git a/tests/sockets/test_sockets_echo_client.c b/tests/sockets/test_sockets_echo_client.c
index 684d767f..58d005c4 100644
--- a/tests/sockets/test_sockets_echo_client.c
+++ b/tests/sockets/test_sockets_echo_client.c
@@ -10,7 +10,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <assert.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -42,7 +42,7 @@ void finish(int result) {
close(server.fd);
server.fd = 0;
}
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
REPORT_RESULT();
#endif
exit(result);
@@ -160,7 +160,7 @@ int main() {
finish(EXIT_FAILURE);
}
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(main_loop, 0, 0);
#else
while (1) main_loop();
diff --git a/tests/sockets/test_sockets_echo_server.c b/tests/sockets/test_sockets_echo_server.c
index b24472e8..55898add 100644
--- a/tests/sockets/test_sockets_echo_server.c
+++ b/tests/sockets/test_sockets_echo_server.c
@@ -11,7 +11,7 @@
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -186,7 +186,7 @@ int main() {
}
#endif
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(main_loop, 60, 0);
#else
while (1) main_loop();
diff --git a/tests/sockets/test_sockets_partial_client.c b/tests/sockets/test_sockets_partial_client.c
index 61084b17..2d930516 100644
--- a/tests/sockets/test_sockets_partial_client.c
+++ b/tests/sockets/test_sockets_partial_client.c
@@ -10,7 +10,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <assert.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -19,7 +19,7 @@ int sum = 0;
void finish(int result) {
close(sockfd);
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
REPORT_RESULT();
#endif
exit(result);
@@ -108,7 +108,7 @@ int main() {
finish(EXIT_FAILURE);
}
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(iter, 0, 0);
#else
while (1) iter();
diff --git a/tests/sockets/test_sockets_partial_server.c b/tests/sockets/test_sockets_partial_server.c
index f740c307..5c3621a0 100644
--- a/tests/sockets/test_sockets_partial_server.c
+++ b/tests/sockets/test_sockets_partial_server.c
@@ -11,7 +11,7 @@
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -124,7 +124,7 @@ int main() {
exit(EXIT_FAILURE);
}
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(iter, 60, 0);
#else
while (1) iter();
diff --git a/tests/sockets/test_sockets_select_server_closes_connection_client_rw.c b/tests/sockets/test_sockets_select_server_closes_connection_client_rw.c
index e69c3ac0..28a81cd9 100644
--- a/tests/sockets/test_sockets_select_server_closes_connection_client_rw.c
+++ b/tests/sockets/test_sockets_select_server_closes_connection_client_rw.c
@@ -10,7 +10,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <assert.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -24,7 +24,7 @@ msg_t writemsg;
void finish(int result) {
close(sockfd);
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
REPORT_RESULT();
#endif
exit(result);
@@ -216,7 +216,7 @@ int main() {
finish(EXIT_FAILURE);
}
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(main_loop, 0, 0);
#else
while (1) main_loop();
diff --git a/tests/sockets/test_sockets_select_server_down_client.c b/tests/sockets/test_sockets_select_server_down_client.c
index 2765a879..5b050870 100644
--- a/tests/sockets/test_sockets_select_server_down_client.c
+++ b/tests/sockets/test_sockets_select_server_down_client.c
@@ -10,7 +10,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <assert.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -20,7 +20,7 @@ int sockfd = -1;
void finish(int result) {
close(sockfd);
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
REPORT_RESULT();
#endif
exit(result);
@@ -87,7 +87,7 @@ int main() {
finish(EXIT_FAILURE);
}
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(iter, 0, 0);
#else
while (1) iter();
diff --git a/tests/sockets/test_sockets_select_server_down_server.c b/tests/sockets/test_sockets_select_server_down_server.c
index 012932cf..07c5c847 100644
--- a/tests/sockets/test_sockets_select_server_down_server.c
+++ b/tests/sockets/test_sockets_select_server_down_server.c
@@ -10,7 +10,7 @@
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -47,7 +47,7 @@ int main() {
close(serverfd);
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(main_loop, 60, 0);
#else
while (1) main_loop(); sleep(1);
diff --git a/tests/sockets/webrtc_host.c b/tests/sockets/webrtc_host.c
index 866c875c..e482d4ae 100644
--- a/tests/sockets/webrtc_host.c
+++ b/tests/sockets/webrtc_host.c
@@ -9,7 +9,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <assert.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -37,7 +37,7 @@ void iter() {
shutdown(sock, SHUT_RDWR);
close(sock);
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
int result = 1;
REPORT_RESULT();
exit(EXIT_SUCCESS);
@@ -79,7 +79,7 @@ int main(void)
hdr.msg_iov = iov;
hdr.msg_iovlen = 1;
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(iter, 0, 0);
#else
while (!done) iter();
diff --git a/tests/sockets/webrtc_peer.c b/tests/sockets/webrtc_peer.c
index dd44e93e..327782d6 100644
--- a/tests/sockets/webrtc_peer.c
+++ b/tests/sockets/webrtc_peer.c
@@ -9,7 +9,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <assert.h>
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
@@ -71,7 +71,7 @@ int main(void)
hdr.msg_iov = iov;
hdr.msg_iovlen = 1;
-#if EMSCRIPTEN
+#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(iter, 0, 0);
#else
while (!done) iter();