From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> To: Petri Latvala <petri.latvala@intel.com>, Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [PATCH i-g-t] [RFC] Add support to force specific module load Date: Tue, 29 May 2018 21:45:20 -0300 [thread overview] Message-ID: <20180530004520.qnqnainaevyrcoae@smtp.gmail.com> (raw) This patch adds a new option to force the use of a module specified from the command line. The force command expects a module name which will be used on the target test (changing the standard behavior). This feature can be useful for developers that have to create a new module since it is possible to use some of the tests already provided by IGT (e.g., kms_color, core, etc.) as a start point. Additionally, it can also be useful for someone that wants to implement a new set of tests for a specific driver because the developer can first check the behavior of any test in the target module. It is important to highlight, that a force option can produce unexpected results and developers should be aware of that. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> --- lib/drmtest.c | 19 +++++++++++++------ lib/igt_core.c | 20 ++++++++++++++++++++ lib/igt_core.h | 4 ++++ scripts/run-tests.sh | 4 +++- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index fae6f86f..1d2ba178 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -258,6 +258,7 @@ static int __open_device(const char *base, int offset, unsigned int chipset) static int __open_driver(const char *base, int offset, unsigned int chipset) { static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + const char* target; static const struct module { unsigned int bit; const char *module; @@ -276,13 +277,19 @@ static int __open_driver(const char *base, int offset, unsigned int chipset) if (fd != -1) return fd; + target = get_target_module(); + pthread_mutex_lock(&mutex); - for (const struct module *m = modules; m->module; m++) { - if (chipset & m->bit) { - if (m->modprobe) - m->modprobe(m->module); - else - modprobe(m->module); + if (target) { + modprobe(target); + } else { + for (const struct module *m = modules; m->module; m++) { + if (chipset & m->bit) { + if (m->modprobe) + m->modprobe(m->module); + else + modprobe(m->module); + } } } pthread_mutex_unlock(&mutex); diff --git a/lib/igt_core.c b/lib/igt_core.c index 5092a3f0..ed66eae1 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -286,6 +286,7 @@ enum { OPT_DESCRIPTION, OPT_DEBUG, OPT_INTERACTIVE_DEBUG, + OPT_FORCE_MODULE, OPT_HELP = 'h' }; @@ -303,6 +304,20 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER; GKeyFile *igt_key_file; #endif +char *target_module; + +void set_target_module(char *target) +{ + if (!target) + igt_warn("No module specified, keep default behaviour"); + target_module = target; +} + +const char *get_target_module(void) +{ + return target_module; +} + char *igt_frame_dump_path; const char *igt_test_name(void) @@ -555,6 +570,7 @@ static void print_usage(const char *help_str, bool output_on_stderr) " --debug[=log-domain]\n" " --interactive-debug[=domain]\n" " --help-description\n" + " --force-module <module>\n" " --help\n"); if (help_str) fprintf(f, "%s\n", help_str); @@ -666,6 +682,7 @@ static int common_init(int *argc, char **argv, {"debug", optional_argument, 0, OPT_DEBUG}, {"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG}, {"help", 0, 0, OPT_HELP}, + {"force-module", required_argument, 0, OPT_FORCE_MODULE}, {0, 0, 0, 0} }; char *short_opts; @@ -763,6 +780,9 @@ static int common_init(int *argc, char **argv, print_test_description(); ret = -1; goto out; + case OPT_FORCE_MODULE: + set_target_module(strdup(optarg)); + break; case OPT_HELP: print_usage(help_str, false); ret = -1; diff --git a/lib/igt_core.h b/lib/igt_core.h index bf8cd66c..6d635ebd 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -50,6 +50,10 @@ extern const char* __igt_test_description __attribute__((weak)); extern bool __igt_plain_output; extern char *igt_frame_dump_path; +extern char *target_module; +void set_target_module(char *target); +const char *get_target_module(void); + /** * IGT_TEST_DESCRIPTION: * @str: description string diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 4209dd8c..c810a8dd 100755 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -80,6 +80,7 @@ function print_help { echo " (can be used more than once)" echo " -T <filename> run tests listed in testlist" echo " (overrides -t and -x)" + echo " -m <module> force load a specific module" echo " -v enable verbose mode" echo " -x <regex> exclude tests that match the regular expression" echo " (can be used more than once)" @@ -91,7 +92,7 @@ function print_help { echo "Useful patterns for test filtering are described in the API documentation." } -while getopts ":dhlr:st:T:vx:Rn" opt; do +while getopts ":dhlr:st:T:m:vx:Rn" opt; do case $opt in d) download_piglit; exit ;; h) print_help; exit ;; @@ -100,6 +101,7 @@ while getopts ":dhlr:st:T:vx:Rn" opt; do s) SUMMARY="html" ;; t) FILTER="$FILTER -t $OPTARG" ;; T) FILTER="$FILTER --test-list $OPTARG" ;; + m) FILTER="$FILTER -m $OPTARG" ;; v) VERBOSE="-v" ;; x) EXCLUDE="$EXCLUDE -x $OPTARG" ;; R) RESUME="true" ;; -- 2.17.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> To: Petri Latvala <petri.latvala@intel.com>, Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: igt-dev@lists.freedesktop.org, gustavo@padovan.org, intel-gfx@lists.freedesktop.org Subject: [igt-dev] [PATCH i-g-t] [RFC] Add support to force specific module load Date: Tue, 29 May 2018 21:45:20 -0300 [thread overview] Message-ID: <20180530004520.qnqnainaevyrcoae@smtp.gmail.com> (raw) This patch adds a new option to force the use of a module specified from the command line. The force command expects a module name which will be used on the target test (changing the standard behavior). This feature can be useful for developers that have to create a new module since it is possible to use some of the tests already provided by IGT (e.g., kms_color, core, etc.) as a start point. Additionally, it can also be useful for someone that wants to implement a new set of tests for a specific driver because the developer can first check the behavior of any test in the target module. It is important to highlight, that a force option can produce unexpected results and developers should be aware of that. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> --- lib/drmtest.c | 19 +++++++++++++------ lib/igt_core.c | 20 ++++++++++++++++++++ lib/igt_core.h | 4 ++++ scripts/run-tests.sh | 4 +++- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index fae6f86f..1d2ba178 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -258,6 +258,7 @@ static int __open_device(const char *base, int offset, unsigned int chipset) static int __open_driver(const char *base, int offset, unsigned int chipset) { static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + const char* target; static const struct module { unsigned int bit; const char *module; @@ -276,13 +277,19 @@ static int __open_driver(const char *base, int offset, unsigned int chipset) if (fd != -1) return fd; + target = get_target_module(); + pthread_mutex_lock(&mutex); - for (const struct module *m = modules; m->module; m++) { - if (chipset & m->bit) { - if (m->modprobe) - m->modprobe(m->module); - else - modprobe(m->module); + if (target) { + modprobe(target); + } else { + for (const struct module *m = modules; m->module; m++) { + if (chipset & m->bit) { + if (m->modprobe) + m->modprobe(m->module); + else + modprobe(m->module); + } } } pthread_mutex_unlock(&mutex); diff --git a/lib/igt_core.c b/lib/igt_core.c index 5092a3f0..ed66eae1 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -286,6 +286,7 @@ enum { OPT_DESCRIPTION, OPT_DEBUG, OPT_INTERACTIVE_DEBUG, + OPT_FORCE_MODULE, OPT_HELP = 'h' }; @@ -303,6 +304,20 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER; GKeyFile *igt_key_file; #endif +char *target_module; + +void set_target_module(char *target) +{ + if (!target) + igt_warn("No module specified, keep default behaviour"); + target_module = target; +} + +const char *get_target_module(void) +{ + return target_module; +} + char *igt_frame_dump_path; const char *igt_test_name(void) @@ -555,6 +570,7 @@ static void print_usage(const char *help_str, bool output_on_stderr) " --debug[=log-domain]\n" " --interactive-debug[=domain]\n" " --help-description\n" + " --force-module <module>\n" " --help\n"); if (help_str) fprintf(f, "%s\n", help_str); @@ -666,6 +682,7 @@ static int common_init(int *argc, char **argv, {"debug", optional_argument, 0, OPT_DEBUG}, {"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG}, {"help", 0, 0, OPT_HELP}, + {"force-module", required_argument, 0, OPT_FORCE_MODULE}, {0, 0, 0, 0} }; char *short_opts; @@ -763,6 +780,9 @@ static int common_init(int *argc, char **argv, print_test_description(); ret = -1; goto out; + case OPT_FORCE_MODULE: + set_target_module(strdup(optarg)); + break; case OPT_HELP: print_usage(help_str, false); ret = -1; diff --git a/lib/igt_core.h b/lib/igt_core.h index bf8cd66c..6d635ebd 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -50,6 +50,10 @@ extern const char* __igt_test_description __attribute__((weak)); extern bool __igt_plain_output; extern char *igt_frame_dump_path; +extern char *target_module; +void set_target_module(char *target); +const char *get_target_module(void); + /** * IGT_TEST_DESCRIPTION: * @str: description string diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 4209dd8c..c810a8dd 100755 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -80,6 +80,7 @@ function print_help { echo " (can be used more than once)" echo " -T <filename> run tests listed in testlist" echo " (overrides -t and -x)" + echo " -m <module> force load a specific module" echo " -v enable verbose mode" echo " -x <regex> exclude tests that match the regular expression" echo " (can be used more than once)" @@ -91,7 +92,7 @@ function print_help { echo "Useful patterns for test filtering are described in the API documentation." } -while getopts ":dhlr:st:T:vx:Rn" opt; do +while getopts ":dhlr:st:T:m:vx:Rn" opt; do case $opt in d) download_piglit; exit ;; h) print_help; exit ;; @@ -100,6 +101,7 @@ while getopts ":dhlr:st:T:vx:Rn" opt; do s) SUMMARY="html" ;; t) FILTER="$FILTER -t $OPTARG" ;; T) FILTER="$FILTER --test-list $OPTARG" ;; + m) FILTER="$FILTER -m $OPTARG" ;; v) VERBOSE="-v" ;; x) EXCLUDE="$EXCLUDE -x $OPTARG" ;; R) RESUME="true" ;; -- 2.17.0 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2018-05-30 0:45 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-05-30 0:45 Rodrigo Siqueira [this message] 2018-05-30 0:45 ` [igt-dev] [PATCH i-g-t] [RFC] Add support to force specific module load Rodrigo Siqueira 2018-05-30 1:17 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork 2018-05-30 2:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork 2018-06-13 13:05 ` [PATCH i-g-t] [RFC] " Petri Latvala 2018-06-13 13:05 ` [igt-dev] " Petri Latvala 2018-06-17 0:26 ` Rodrigo Siqueira 2018-06-17 0:26 ` [igt-dev] " Rodrigo Siqueira 2018-06-18 12:46 ` Petri Latvala 2018-06-18 12:46 ` [Intel-gfx] " Petri Latvala 2018-06-19 23:36 ` Rodrigo Siqueira 2018-06-19 23:36 ` Rodrigo Siqueira
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=20180530004520.qnqnainaevyrcoae@smtp.gmail.com \ --to=rodrigosiqueiramelo@gmail.com \ --cc=arkadiusz.hiler@intel.com \ --cc=igt-dev@lists.freedesktop.org \ --cc=intel-gfx@lists.freedesktop.org \ --cc=petri.latvala@intel.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.