mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-06 07:37:21 +02:00
Add game_mode_run_tests function to trigger tests
This commit is contained in:
parent
951cf1f8b9
commit
94cfa2de54
@ -131,3 +131,8 @@ void game_mode_apply_scheduling(const GameModeContext *self, const pid_t client)
|
||||
bool game_mode_detect_wine_loader(const char *exe);
|
||||
bool game_mode_detect_wine_preloader(const char *exe);
|
||||
char *game_mode_resolve_wine_preloader(const pid_t pid);
|
||||
|
||||
/** gamemode-tests.c
|
||||
* Provides a test suite to verify gamemode behaviour
|
||||
*/
|
||||
int game_mode_run_tests(void);
|
||||
|
@ -97,6 +97,7 @@ int main(int argc, char *argv[])
|
||||
bool daemon = false;
|
||||
bool use_syslog = false;
|
||||
int opt = 0;
|
||||
int status;
|
||||
while ((opt = getopt(argc, argv, "dlsrtvh")) != -1) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
@ -106,8 +107,6 @@ int main(int argc, char *argv[])
|
||||
use_syslog = true;
|
||||
break;
|
||||
case 's': {
|
||||
int status;
|
||||
|
||||
if ((status = gamemode_query_status()) < 0) {
|
||||
fprintf(stderr, "gamemode status request failed: %s\n", gamemode_error_string());
|
||||
exit(EXIT_FAILURE);
|
||||
@ -126,8 +125,7 @@ int main(int argc, char *argv[])
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int status = gamemode_query_status();
|
||||
if (status == 2) {
|
||||
if ((status = gamemode_query_status()) == 2) {
|
||||
fprintf(stdout, "gamemode request succeeded and is active\n");
|
||||
} else if (status == 1) {
|
||||
fprintf(stderr,
|
||||
@ -144,8 +142,16 @@ int main(int argc, char *argv[])
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case 't':
|
||||
fprintf(stdout, "Running tests...\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
if ((status = game_mode_run_tests()) == 0) {
|
||||
fprintf(stdout, "gamemode tests succeeded\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
} else if (status == -1) {
|
||||
fprintf(stderr, "gamemode tests failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
fprintf(stderr, "gamemode test results unknown: %d\n", status);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
fprintf(stdout, VERSION_TEXT);
|
||||
|
@ -23,6 +23,7 @@ daemon_sources = [
|
||||
'gamemode-proc.c',
|
||||
'gamemode-sched.c',
|
||||
'gamemode-wine.c',
|
||||
'gamemode-tests.c',
|
||||
'daemonize.c',
|
||||
'dbus_messaging.c',
|
||||
'governors.c',
|
||||
|
Loading…
x
Reference in New Issue
Block a user