-/* After getting the command line args, but before running
- * anything, we check everything is in place to do the tests.
- */
-static void
-preruncheck (void)
-{
- int r;
- FILE *fp;
- char cmd[256];
- char buffer[1024];
-
- if (access (helper, R_OK) == -1) {
- fprintf (stderr,
- _("Test tool helper program 'libguestfs-test-tool-helper' is not\n"
- "available. Expected to find it in '%s'\n"
- "\n"
- "Use the --helper option to specify the location of this program.\n"),
- helper);
- exit (EXIT_FAILURE);
- }
-
- snprintf (cmd, sizeof cmd, "file '%s'", helper);
- fp = popen (cmd, "r");
- if (fp == NULL) {
- perror (cmd);
- exit (EXIT_FAILURE);
- }
- r = fread (buffer, 1, sizeof buffer - 1, fp);
- if (r == 0) {
- fprintf (stderr, _("command failed: %s"), cmd);
- exit (EXIT_FAILURE);
- }
- pclose (fp);
- buffer[r] = '\0';
-
- if (strstr (buffer, "statically linked") == NULL) {
- fprintf (stderr,
- _("Test tool helper program %s\n"
- "is not statically linked. This is a build error when this test tool\n"
- "was built.\n"),
- helper);
- exit (EXIT_FAILURE);
- }
-}
-