[igt-dev] [PATCH i-g-t 1/3] runner: Make generate_piglit_name non-static

Petri Latvala petri.latvala at intel.com
Thu Sep 20 10:55:05 UTC 2018


and move it to job_list.c

Signed-off-by: Petri Latvala <petri.latvala at intel.com>
---
 runner/job_list.c  | 37 +++++++++++++++++++++++++++++++++++++
 runner/job_list.h  |  3 +++
 runner/resultgen.c | 36 ------------------------------------
 3 files changed, 40 insertions(+), 36 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));
diff --git a/runner/job_list.h b/runner/job_list.h
index c726ab09..f8bbbddc 100644
--- a/runner/job_list.h
+++ b/runner/job_list.h
@@ -27,6 +27,9 @@ struct job_list
 	size_t size;
 };
 
+void generate_piglit_name(const char *binary, const char *subtest,
+			  char *namebuf, size_t namebuf_size);
+
 void init_job_list(struct job_list *job_list);
 void free_job_list(struct job_list *job_list);
 bool create_job_list(struct job_list *job_list, struct settings *settings);
diff --git a/runner/resultgen.c b/runner/resultgen.c
index d939583d..d34b52db 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -148,22 +148,6 @@ static size_t count_lines(const char *buf, const char *bufend)
 	return ret;
 }
 
-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;
-}
-
 static void append_line(char **buf, size_t *buflen, char *line)
 {
 	size_t linelen = strlen(line);
@@ -173,26 +157,6 @@ static void append_line(char **buf, size_t *buflen, char *line)
 	*buflen += linelen;
 }
 
-static 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);
-}
-
 static const struct {
 	const char *output_str;
 	const char *result_str;
-- 
2.18.0



More information about the igt-dev mailing list