Browse Source

cmake: Allow running the uvsample tests in parallel (#518)

Since they were using the same port they failed when running in parallel
Jaime Marquínez Ferrándiz 2 years ago
parent
commit
01f19205f2
2 changed files with 4 additions and 4 deletions
  1. 2 2
      CMakeLists.txt
  2. 2 2
      other/uvsample/UVSample.hx

+ 2 - 2
CMakeLists.txt

@@ -307,7 +307,7 @@ if(BUILD_TESTING)
         COMMAND hl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/threads.hl
     )
     add_test(NAME uvsample.hl
-        COMMAND hl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/uvsample.hl
+        COMMAND hl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/uvsample.hl 6001
     )
     add_test(NAME hello
         COMMAND hello
@@ -316,7 +316,7 @@ if(BUILD_TESTING)
         COMMAND threads
     )
     add_test(NAME uvsample
-        COMMAND uvsample
+        COMMAND uvsample 6002
     )
     add_test(NAME version
         COMMAND hl --version

+ 2 - 2
other/uvsample/UVSample.hx

@@ -37,11 +37,11 @@ class UVSample {
 		*/
 
 		var host = new sys.net.Host("localhost");
-		var port = 6001;
+		var port = Std.parseInt(Sys.args()[0]);
 
 		var totR = 0, totW = 0, totRB = 0;
 
-		log("Starting server");
+		log('Starting server on port ${port}');
 		tcp.bind(host, port);
 		tcp.listen(5, function() {