summaryrefslogtreecommitdiff
path: root/runner/job_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'runner/job_list.c')
-rw-r--r--runner/job_list.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/runner/job_list.c b/runner/job_list.c
index 5fe88e4f..88f59b05 100644
--- a/runner/job_list.c
+++ b/runner/job_list.c
@@ -1,3 +1,4 @@
+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/limits.h>
@@ -284,6 +285,42 @@ static bool job_list_from_test_list(struct job_list *job_list,
return any;
}
+static char *lowercase(const char *str)
+{
+ char *ret = malloc(strlen(str) + 1);
+ char *q = ret;
+
+ while (*str) {
+ if (isspace(*str))
+ break;
+
+ *q++ = tolower(*str++);
+ }
+ *q = '\0';
+
+ return ret;
+}
+
+void generate_piglit_name(const char *binary, const char *subtest,
+ char *namebuf, size_t namebuf_size)
+{
+ char *lc_binary = lowercase(binary);
+ char *lc_subtest = NULL;
+
+ if (!subtest) {
+ snprintf(namebuf, namebuf_size, "igt@%s", lc_binary);
+ free(lc_binary);
+ return;
+ }
+
+ lc_subtest = lowercase(subtest);
+
+ snprintf(namebuf, namebuf_size, "igt@%s@%s", lc_binary, lc_subtest);
+
+ free(lc_binary);
+ free(lc_subtest);
+}
+
void init_job_list(struct job_list *job_list)
{
memset(job_list, 0, sizeof(*job_list));