- /*
- * What all of this mess does is:
- * 1. Launch Xvfb on the next available DISPLAY. Xvfb reports the
- * display number to an fd passed with -displayfd once it's
- * initialized. We pass a pipe there to read it.
- * 2. Make an xcb connection to this display.
- * 3. Launch xkbcomp to change the keymap of the new display (doing
- * this programmatically is major work [which we may yet do some
- * day for xkbcommon-x11] so we use xkbcomp for now).
- * 4. Download the keymap back from the display using xkbcommon-x11.
- * 5. Compare received keymap to the uploaded keymap.
- * 6. Kill the server & clean up.
- */
-
- ret = pipe(pipefds);
- assert(ret == 0);
-
- ret = snprintf(displayfd, sizeof(displayfd), "%d", pipefds[1]);
- assert(ret >= 0 && ret < sizeof(displayfd));
-
- ret = posix_spawnp(&xvfb_pid, "Xvfb", NULL, NULL, xvfb_argv, envp);
- if (ret != 0) {
- ret = SKIP_TEST;
- goto err_ctx;
- }
-
- display[0] = ':';
- ret = read(pipefds[0], display + 1, sizeof(display) - 1);
- assert(ret > 0 && 1 + ret < sizeof(display) - 1);
- if (display[ret] == '\n')
- display[ret] = '\0';
- display[1 + ret] = '\0';
- close(pipefds[0]);
- close(pipefds[1]);
-