X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=meta-agl-core%2Frecipes-support%2Fptest-runner%2Fptest-runner%2F0007-WIP-Initial-LAVA-support.patch;h=3757fe0a7582e665bf5ee04cf41043e2673f05f6;hb=refs%2Fchanges%2F77%2F29977%2F2;hp=bded7ba243e181f76b8a2b97e30fba57461f4e44;hpb=d9280a65ce81eb7b9f3205ac45052b844cd1e74c;p=AGL%2Fmeta-agl.git diff --git a/meta-agl-core/recipes-support/ptest-runner/ptest-runner/0007-WIP-Initial-LAVA-support.patch b/meta-agl-core/recipes-support/ptest-runner/ptest-runner/0007-WIP-Initial-LAVA-support.patch index bded7ba24..3757fe0a7 100644 --- a/meta-agl-core/recipes-support/ptest-runner/ptest-runner/0007-WIP-Initial-LAVA-support.patch +++ b/meta-agl-core/recipes-support/ptest-runner/ptest-runner/0007-WIP-Initial-LAVA-support.patch @@ -1,4 +1,4 @@ -From edb252e5dae20869081a22e1e18cde4336c7b31c Mon Sep 17 00:00:00 2001 +From bdcbb0e78bbffe45719d0a27954544120f37442a Mon Sep 17 00:00:00 2001 From: Tim Orling Date: Mon, 15 Oct 2018 18:30:42 -0700 Subject: [PATCH] Initial LAVA support @@ -17,16 +17,20 @@ emitted to stdout: It is valid to have a measurement without units, but not units without a measurement. +Upstream-Status: Pending + Signed-off-by: Tim Orling [updated for ptest-runner 2.3.2] +[updated for ptest-runner 2.4.1] +[updated for ptest-runner 2.4.2] +[updated for ptest-runner 2.4.4] Signed-off-by: Scott Murray - --- flags.h | 10 ++++++++++ main.c | 9 ++++++++- - utils.c | 14 ++++++++++++++ + utils.c | 20 +++++++++++++++++++- utils.h | 2 +- - 4 files changed, 33 insertions(+), 2 deletions(-) + 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 flags.h diff --git a/flags.h b/flags.h @@ -46,7 +50,7 @@ index 0000000..0dac223 + +#endif /* __FLAGS_H__ */ diff --git a/main.c b/main.c -index e3a1b69..4807183 100644 +index 31e4dd5..f12d6d6 100644 --- a/main.c +++ b/main.c @@ -38,6 +38,7 @@ @@ -57,7 +61,7 @@ index e3a1b69..4807183 100644 #ifndef DEFAULT_DIRECTORY #define DEFAULT_DIRECTORY "/usr/lib" -@@ -110,8 +111,9 @@ main(int argc, char *argv[]) +@@ -130,8 +131,9 @@ main(int argc, char *argv[]) opts.timeout = DEFAULT_TIMEOUT; opts.ptests = NULL; opts.xml_filename = NULL; @@ -68,7 +72,7 @@ index e3a1b69..4807183 100644 switch (opt) { case 'd': free(opts.dirs[0]); -@@ -136,6 +138,11 @@ main(int argc, char *argv[]) +@@ -156,6 +158,11 @@ main(int argc, char *argv[]) opts.xml_filename = strdup(optarg); CHECK_ALLOCATION(opts.xml_filename, 1, 1); break; @@ -81,46 +85,46 @@ index e3a1b69..4807183 100644 print_usage(stdout, argv[0]); exit(1); diff --git a/utils.c b/utils.c -index a4e190e..29f40f3 100644 +index 6cf7705..f6a3a2a 100644 --- a/utils.c +++ b/utils.c -@@ -47,6 +47,7 @@ +@@ -49,6 +49,7 @@ #include "ptest_list.h" #include "utils.h" +#include "flags.h" #define GET_STIME_BUF_SIZE 1024 - #define WAIT_CHILD_POLL_TIMEOUT_MS 200 -@@ -442,6 +443,7 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, - } - PTEST_LIST_ITERATE_START(head, p) - char *ptest_dir = strdup(p->run_ptest); + #define WAIT_CHILD_BUF_MAX_SIZE 1024 +@@ -369,6 +370,9 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, + strcpy(ptest_dir, p->run_ptest); + dirname(ptest_dir); + + char *ptest = strdup(p->ptest); - if (ptest_dir == NULL) { ++ CHECK_ALLOCATION(ptest, 1, 1); ++ + if (pipe2(pipefd_stdout, 0) == -1) { + fprintf(fp, "ERROR: pipe2() failed with: %s.\n", strerror(errno)); rc = -1; - break; -@@ -480,11 +482,15 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, - int status; - int fds[2]; fds[0] = pipefd_stdout[0]; fds[1] = pipefd_stderr[0]; - FILE *fps[2]; fps[0] = fp; fps[1] = fp_stderr; -+ char result[5]; // pass\0, fail\0, skip\0 - - if (setpgid(child, pgid) == -1) { - fprintf(fp, "ERROR: setpgid() failed, %s\n", strerror(errno)); - } +@@ -425,7 +429,10 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, + do_close(&pipefd_stdout[PIPE_WRITE]); + do_close(&pipefd_stderr[PIPE_WRITE]); +- time_t start_time= time(NULL); + if (opts.flags & LAVA_SIGNAL_ENABLE) { + fprintf(stdout, "\n", ptest); + } - sttime = time(NULL); - fprintf(fp, "%s\n", get_stime(stime, GET_STIME_BUF_SIZE, sttime)); ++ time_t start_time = time(NULL); + fprintf(fp, "%s\n", get_stime(stime, GET_STIME_BUF_SIZE, start_time)); fprintf(fp, "BEGIN: %s\n", ptest_dir); -@@ -506,6 +512,14 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, + +@@ -542,6 +549,16 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, fprintf(fp, "END: %s\n", ptest_dir); - fprintf(fp, "%s\n", get_stime(stime, GET_STIME_BUF_SIZE, entime)); + fprintf(fp, "%s\n", get_stime(stime, GET_STIME_BUF_SIZE, end_time)); + if (opts.flags & LAVA_SIGNAL_ENABLE) { ++ char result[5]; // pass\0, fail\0, skip\0 ++ + if (status) + sprintf(result, "fail"); + else @@ -129,14 +133,22 @@ index a4e190e..29f40f3 100644 + fprintf(stdout, "\n", ptest, result); + } } - PTEST_LIST_ITERATE_END - fprintf(fp, "STOP: %s\n", progname); + + ptest_list_fail4: +@@ -556,6 +573,7 @@ ptest_list_fail2: + do_close(&pipefd_stdout[PIPE_WRITE]); + + ptest_list_fail1: ++ free(ptest); + fflush(fp); + fflush(fp_stderr); + diff --git a/utils.h b/utils.h -index 39832e6..8137bd6 100644 +index 04fc666..ad702d8 100644 --- a/utils.h +++ b/utils.h -@@ -41,9 +41,9 @@ struct ptest_options { - int timeout; +@@ -42,9 +42,9 @@ struct ptest_options { + unsigned int timeout; char **ptests; char *xml_filename; + unsigned int flags; @@ -146,3 +158,6 @@ index 39832e6..8137bd6 100644 extern void check_allocation1(void *, size_t, char *, int, int); extern struct ptest_list *get_available_ptests(const char *); extern int print_ptests(struct ptest_list *, FILE *); +-- +2.44.0 +