make the task name depend on the test we're running
authorDavid Zeuthen <davidz@redhat.com>
Sun, 30 Mar 2008 18:38:13 +0000 (14:38 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Sun, 30 Mar 2008 18:38:13 +0000 (14:38 -0400)
src/job-smart-selftest.c

index 5009e7f..9d7fe3d 100644 (file)
@@ -95,6 +95,7 @@ main (int argc, char **argv)
         const char *test;
         gboolean captive;
         const char *result;
+        const char *taskname;
 
         ret = 1;
         command_line = NULL;
@@ -109,6 +110,15 @@ main (int argc, char **argv)
         test = argv[2];
         captive = (strcmp (argv[3], "1") == 0);
 
+        if (strcmp (test, "short") == 0) {
+                taskname = "smartselftest_short";
+        } else if (strcmp (test, "long") == 0) {
+                taskname = "smartselftest_long";
+        } else {
+                g_printerr ("unknown test '%s'", test);
+                goto out;
+        }
+
         g_print ("device   = '%s'\n", device);
         g_print ("test     = '%s'\n", test);
         g_print ("captive  = %d\n", captive);
@@ -143,16 +153,18 @@ main (int argc, char **argv)
 
 
         /* progress at 0% initially */
-        g_print ("progress: 0 1 0 smartselftest\n");
+        g_print ("progress: 0 1 0 %s\n", taskname);
 
         while (TRUE) {
-                int exec_status = -1;
+                int n;
+                char **lines;
                 int percentage_done;
+                int exec_status = -1;
 
                 sleep (5);
 
                 if (cancelled) {
-                        g_printerr ("Abort test and exiting since we caught SIGTERM\n");
+                        g_printerr ("Aborting test and exiting since we caught SIGTERM\n");
                         abort_test ();
                         goto out;
                 }
@@ -173,9 +185,6 @@ main (int argc, char **argv)
                 g_free (standard_error);
                 standard_error = NULL;
 
-                int n;
-                char **lines;
-
                 lines = g_strsplit (standard_output, "\n", 0);
                 for (n = 0; lines[n] != NULL; n++) {
                         const char *line = (const char *) lines[n];
@@ -211,7 +220,7 @@ main (int argc, char **argv)
 
                 if ((exec_status >> 4) == 15) {
                         percentage_done = 100 - (exec_status & 0x0f) * 10;
-                        g_print ("progress: 0 1 %d smartselftest\n", percentage_done);
+                        g_print ("progress: 0 1 %d %s\n", percentage_done, taskname);
                 } else {
                         switch ((exec_status)>>4){
                         case  0: