|
@@ -127,12 +127,6 @@ static int run_basic_client_tests(void)
|
|
|
{
|
|
|
LOG_MSG(":: Basic client tests\n");
|
|
|
|
|
|
-
|
|
|
- * As well as it being currently installed and queryable
|
|
|
- */
|
|
|
- if (verify_gamemode_initial() != 0)
|
|
|
- return -1;
|
|
|
-
|
|
|
|
|
|
if (gamemode_request_start() != 0) {
|
|
|
LOG_ERROR("gamemode_request_start failed: %s\n", gamemode_error_string());
|
|
@@ -576,6 +570,76 @@ static int game_mode_run_feature_tests(struct GameModeConfig *config)
|
|
|
return status;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+static int run_supervisor_tests(void)
|
|
|
+{
|
|
|
+ int supervisortests = 0;
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ LOG_MSG(":: Supervisor tests\n");
|
|
|
+
|
|
|
+
|
|
|
+ pid_t pid = fork();
|
|
|
+ if( pid == 0 )
|
|
|
+ {
|
|
|
+
|
|
|
+ pause();
|
|
|
+ exit(EXIT_SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ret = gamemode_request_start_for(pid);
|
|
|
+ if(ret != 0)
|
|
|
+ {
|
|
|
+ LOG_ERROR("gamemode_request_start_for gave unexpected value %d, (expected 0)!\n", ret);
|
|
|
+ supervisortests = -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ret = gamemode_query_status();
|
|
|
+ if(ret != 1)
|
|
|
+ {
|
|
|
+ LOG_ERROR("gamemode_query_status gave unexpected value %d, (expected 1)!\n", ret);
|
|
|
+ supervisortests = -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ret = gamemode_query_status_for(pid);
|
|
|
+ if (ret != 2) {
|
|
|
+ LOG_ERROR("gamemode_query_status_for gave unexpected value %d, (expected 2)!\n", ret);
|
|
|
+ supervisortests = -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ret = gamemode_request_end_for(pid);
|
|
|
+ if(ret != 0)
|
|
|
+ {
|
|
|
+ LOG_ERROR("gamemode_request_start_for gave unexpected value %d, (expected 0)!\n", ret);
|
|
|
+ supervisortests = -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ret = gamemode_query_status();
|
|
|
+ if(ret != 0)
|
|
|
+ {
|
|
|
+ LOG_ERROR("gamemode_query_status gave unexpected value %d, (expected 0)!\n", ret);
|
|
|
+ supervisortests = -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (kill(pid, SIGUSR1) == -1) {
|
|
|
+ LOG_ERROR("failed to send continue signal to other child process: %s\n", strerror(errno));
|
|
|
+ supervisortests = -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (supervisortests == 0)
|
|
|
+ LOG_MSG(":: Passed\n\n");
|
|
|
+ else
|
|
|
+ LOG_ERROR(":: Failed!\n");
|
|
|
+
|
|
|
+ return supervisortests;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
* game_mode_run_client_tests runs a set of tests of the client code
|
|
|
* we simply verify that the client can request the status and recieves the correct results
|
|
@@ -595,6 +659,22 @@ int game_mode_run_client_tests()
|
|
|
|
|
|
LOG_MSG(": Running tests\n\n");
|
|
|
|
|
|
+
|
|
|
+ * As well as it being currently installed and queryable
|
|
|
+ */
|
|
|
+ if (verify_gamemode_initial() != 0)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if( config_get_require_supervisor(config) != 0 )
|
|
|
+ {
|
|
|
+ LOG_ERROR("Tests currently unsupported when require_supervisor is set\n");
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if (run_basic_client_tests() != 0)
|
|
|
status = -1;
|
|
@@ -607,6 +687,10 @@ int game_mode_run_client_tests()
|
|
|
if (run_gamemoderun_and_reaper_tests(config) != 0)
|
|
|
status = -1;
|
|
|
|
|
|
+
|
|
|
+ if (run_supervisor_tests() != 0)
|
|
|
+ status = -1;
|
|
|
+
|
|
|
if (status != 0) {
|
|
|
LOG_MSG(": Client tests failed, skipping feature tests\n");
|
|
|
} else {
|