From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 2/3] runner/settings: add compressor option
Date: Fri, 18 Aug 2023 21:22:02 +0200 [thread overview]
Message-ID: <20230818192203.75155-3-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20230818192203.75155-1-kamil.konieczny@linux.intel.com>
Add new option --compressor for selecting compressor like bzip2,
lzma, xz or other. This will allow to choose tool (with options)
for compressing too large kernel dmesg dumps after limiting its
inclusion into results.json file.
While at it check also if compressor is available on system
before using it.
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
runner/settings.c | 34 +++++++++++++++++++++++++++++++++-
runner/settings.h | 1 +
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/runner/settings.c b/runner/settings.c
index 23aa82963..e3828ace6 100644
--- a/runner/settings.c
+++ b/runner/settings.c
@@ -28,6 +28,7 @@ enum {
OPT_CODE_COV_SCRIPT,
OPT_ENABLE_CODE_COVERAGE,
OPT_COV_RESULTS_PER_TEST,
+ OPT_COMPRESSOR,
OPT_VERSION,
OPT_PRUNE_MODE,
OPT_HELP = 'h',
@@ -297,6 +298,10 @@ static const char *usage_str =
" Requires --collect-script FILENAME\n"
" --collect-script FILENAME\n"
" Use FILENAME as script to collect code coverage data.\n"
+ " --compressor NAME\n"
+ " Use compressor (bzip2, gzip, lzma, xz or other) for\n"
+ " compressing dmesg dumps which exceed limit size\n"
+ " compressing dmesg dumps which exceed limit size\n"
"\n"
" [test_root] Directory that contains the IGT tests. The environment\n"
" variable IGT_TEST_ROOT will be used if set, overriding\n"
@@ -654,6 +659,7 @@ bool parse_options(int argc, char **argv,
{"collect-code-cov", no_argument, NULL, OPT_ENABLE_CODE_COVERAGE},
{"coverage-per-test", no_argument, NULL, OPT_COV_RESULTS_PER_TEST},
{"collect-script", required_argument, NULL, OPT_CODE_COV_SCRIPT},
+ {"compressor", required_argument, NULL, OPT_COMPRESSOR},
{"multiple-mode", no_argument, NULL, OPT_MULTIPLE},
{"inactivity-timeout", required_argument, NULL, OPT_TIMEOUT},
{"per-test-timeout", required_argument, NULL, OPT_PER_TEST_TIMEOUT},
@@ -740,7 +746,9 @@ bool parse_options(int argc, char **argv,
case OPT_CODE_COV_SCRIPT:
settings->code_coverage_script = bin_path(optarg);
break;
-
+ case OPT_COMPRESSOR:
+ settings->compressor = bin_path(optarg);
+ break;
case OPT_MULTIPLE:
settings->multiple_mode = true;
break;
@@ -902,6 +910,28 @@ bool validate_settings(struct settings *settings)
}
}
+ if (settings->compressor) {
+ char buf[2*PATH_MAX + 512];
+ char apath[PATH_MAX + 256];
+ int r;
+
+ snprintf(apath, sizeof(apath), "%s/%s", settings->results_path, "compressor-path.txt");
+ snprintf(buf, sizeof(buf), "which %s > %s", settings->compressor, apath);
+ system(buf);
+ fd = open(apath, O_RDONLY);
+ if (fd < 0) {
+ fprintf(stderr, "Check for compressor %s on system failed\n", settings->compressor);
+ return false;
+ }
+
+ r = read(fd, buf, 256);
+ close(fd);
+ if (r < 2) {
+ fprintf(stderr, "No compressor %s found on system\n", settings->compressor);
+ return false;
+ }
+ }
+
return true;
}
@@ -1039,6 +1069,7 @@ bool serialize_settings(struct settings *settings)
SERIALIZE_LINE(f, settings, enable_code_coverage, "%d");
SERIALIZE_LINE(f, settings, cov_results_per_test, "%d");
SERIALIZE_LINE(f, settings, code_coverage_script, "%s");
+ SERIALIZE_LINE(f, settings, compressor, "%s");
if (settings->sync) {
fflush(f);
@@ -1102,6 +1133,7 @@ bool read_settings_from_file(struct settings *settings, FILE *f)
PARSE_LINE(settings, name, val, enable_code_coverage, numval);
PARSE_LINE(settings, name, val, cov_results_per_test, numval);
PARSE_LINE(settings, name, val, code_coverage_script, val ? strdup(val) : NULL);
+ PARSE_LINE(settings, name, val, compressor, val ? strdup(val) : NULL);
printf("Warning: Unknown field in settings file: %s = %s\n",
name, val);
diff --git a/runner/settings.h b/runner/settings.h
index 819c34602..abc348dc0 100644
--- a/runner/settings.h
+++ b/runner/settings.h
@@ -72,6 +72,7 @@ struct settings {
char *code_coverage_script;
bool enable_code_coverage;
bool cov_results_per_test;
+ char *compressor;
};
/**
--
2.39.2
next prev parent reply other threads:[~2023-08-18 19:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-18 19:22 [igt-dev] [PATCH i-g-t 0/3] RFC: runner/resultgen: lower dmesg copied when size limit was exceeded Kamil Konieczny
2023-08-18 19:22 ` [igt-dev] [PATCH i-g-t 1/3] runner/resultgen: limit dmesg added into results Kamil Konieczny
2023-08-18 19:22 ` Kamil Konieczny [this message]
2023-08-18 19:22 ` [igt-dev] [PATCH i-g-t 3/3] runner/resultgen: compress dmesg if size limit hit Kamil Konieczny
2023-08-18 19:28 ` [igt-dev] ✗ Fi.CI.BUILD: failure for RFC: runner/resultgen: lower dmesg copied when size limit was exceeded Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230818192203.75155-3-kamil.konieczny@linux.intel.com \
--to=kamil.konieczny@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox