🧑‍💻 Check for Xephyr availability before running tests

This commit is contained in:
Paul Breugnot 2025-03-02 09:11:31 +01:00
parent 599610fd6f
commit b47ccfd93a
3 changed files with 24 additions and 4 deletions

View file

@ -44,7 +44,23 @@ void tear_down_test_logger(void) {
zlog_fini();
}
bool check_xephyr_available() {
xephyr_pid = fork();
if(xephyr_pid == 0) {
char* args[] = {"which", "Xephyr", NULL};
execvp(args[0], args);
}
int stat_loc;
waitpid(xephyr_pid, &stat_loc, 0);
if(stat_loc != 0) {
zlog_error(test_log, "Xephyr executable not found. Make sure it is installed and available in your PATH.");
return false;
}
return true;
}
void setUp(void) {
tmpnam(display_fd); // Creates a temporary file name
sprintf(display_name, ":%u", display_count); // Loads initial display count
// in display name