* [igt-dev] [PATCH i-g-t] lib/igt_core: Rework extra options conflicts handling
@ 2019-05-16 13:02 Arkadiusz Hiler
2019-05-16 14:25 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Arkadiusz Hiler @ 2019-05-16 13:02 UTC (permalink / raw)
To: igt-dev; +Cc: Petri Latvala
This started simple, as a fixup for a warning:
In file included from ../lib/drmtest.h:39,
from ../lib/igt_core.c:60:
../lib/igt_core.c: In function ‘common_init’:
../lib/igt_core.h:891:24: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
891 | #define igt_warn(f...) igt_log(IGT_LOG_DOMAIN, IGT_LOG_WARN, f)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/igt_core.c:704:4: note: in expansion of macro ‘igt_warn’
704 | igt_warn("Conflicting long and short option values between --%s and -%s\n",
| ^~~~~~~~
../lib/igt_core.c:704:73: note: format string is defined here
704 | igt_warn("Conflicting long and short option values between --%s and -%s\n",
| ^~
But it ended up doing the following things:
1. Promote all igt_warns to _critical and assert afterwards.
2. Use for loop instead of a while-doing-for's-job.
3. Streamline calculation of the option list sizes.
4. Add checks for long option names.
5. Log about "'val' representation" instead of confusing "value".
6. Log correct things so we won't %s on a NULL.
7. Write tests to confirm that it works.
Cc: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
lib/igt_core.c | 72 +++++++++++++----------
lib/tests/igt_conflicting_args.c | 99 ++++++++++++++++++++++++++++++++
lib/tests/meson.build | 1 +
3 files changed, 141 insertions(+), 31 deletions(-)
create mode 100644 lib/tests/igt_conflicting_args.c
diff --git a/lib/igt_core.c b/lib/igt_core.c
index d5d4fce2..6bbc805c 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -666,12 +666,12 @@ static int common_init(int *argc, char **argv,
{
int c, option_index = 0, i, x;
static struct option long_options[] = {
- {"list-subtests", 0, 0, OPT_LIST_SUBTESTS},
- {"run-subtest", 1, 0, OPT_RUN_SUBTEST},
- {"help-description", 0, 0, OPT_DESCRIPTION},
- {"debug", optional_argument, 0, OPT_DEBUG},
- {"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
- {"help", 0, 0, OPT_HELP},
+ {"list-subtests", no_argument, NULL, OPT_LIST_SUBTESTS},
+ {"run-subtest", required_argument, NULL, OPT_RUN_SUBTEST},
+ {"help-description", no_argument, NULL, OPT_DESCRIPTION},
+ {"debug", optional_argument, NULL, OPT_DEBUG},
+ {"interactive-debug", optional_argument, NULL, OPT_INTERACTIVE_DEBUG},
+ {"help", no_argument, NULL, OPT_HELP},
{0, 0, 0, 0}
};
char *short_opts;
@@ -687,48 +687,58 @@ static int common_init(int *argc, char **argv,
if (strrchr(command_str, '/'))
command_str = strrchr(command_str, '/') + 1;
- /* First calculate space for all passed-in extra long options */
- all_opt_count = 0;
- while (extra_long_opts && extra_long_opts[all_opt_count].name) {
+ /* Check for conflicts and calculate space for passed-in extra long options */
+ for (extra_opt_count = 0; extra_long_opts && extra_long_opts[extra_opt_count].name; extra_opt_count++) {
+ char *conflicting_char;
/* check for conflicts with standard long option values */
- for (i = 0; long_options[i].name; i++)
- if (extra_long_opts[all_opt_count].val == long_options[i].val)
- igt_warn("Conflicting long option values between --%s and --%s\n",
- extra_long_opts[all_opt_count].name,
+ for (i = 0; long_options[i].name; i++) {
+ if (0 == strcmp(extra_long_opts[extra_opt_count].name, long_options[i].name)) {
+ igt_critical("Conflicting extra long option defined --%s\n", long_options[i].name);
+ assert(0);
+
+ }
+
+ if (extra_long_opts[extra_opt_count].val == long_options[i].val) {
+ igt_critical("Conflicting long option 'val' representation between --%s and --%s\n",
+ extra_long_opts[extra_opt_count].name,
long_options[i].name);
-
- /* check for conflicts with short options */
- if (extra_long_opts[all_opt_count].val != ':'
- && strchr(std_short_opts, extra_long_opts[all_opt_count].val)) {
- igt_warn("Conflicting long and short option values between --%s and -%s\n",
- extra_long_opts[all_opt_count].name,
- long_options[i].name);
+ assert(0);
+ }
}
-
- all_opt_count++;
+ /* check for conflicts with standard short options */
+ if (extra_long_opts[extra_opt_count].val != ':'
+ && (conflicting_char = strchr(std_short_opts, extra_long_opts[extra_opt_count].val))) {
+ igt_critical("Conflicting long and short option 'val' representation between --%s and -%c\n",
+ extra_long_opts[extra_opt_count].name,
+ *conflicting_char);
+ assert(0);
+ }
}
- extra_opt_count = all_opt_count;
/* check for conflicts in extra short options*/
for (i = 0; extra_short_opts && extra_short_opts[i]; i++) {
-
if (extra_short_opts[i] == ':')
continue;
/* check for conflicts with standard short options */
- if (strchr(std_short_opts, extra_short_opts[i]))
- igt_warn("Conflicting short option: -%c\n", std_short_opts[i]);
+ if (strchr(std_short_opts, extra_short_opts[i])) {
+ igt_critical("Conflicting short option: -%c\n", std_short_opts[i]);
+ assert(0);
+ }
/* check for conflicts with standard long option values */
- for (x = 0; long_options[x].name; x++)
- if (long_options[x].val == extra_short_opts[i])
- igt_warn("Conflicting short option and long option value: --%s and -%c\n",
- long_options[x].name, extra_short_opts[i]);
+ for (x = 0; long_options[x].name; x++) {
+ if (long_options[x].val == extra_short_opts[i]) {
+ igt_critical("Conflicting short option and long option 'val' representation: --%s and -%c\n",
+ long_options[x].name, extra_short_opts[i]);
+ assert(0);
+ }
+ }
}
- all_opt_count += ARRAY_SIZE(long_options);
+ all_opt_count = extra_opt_count + ARRAY_SIZE(long_options);
combined_opts = malloc(all_opt_count * sizeof(*combined_opts));
if (extra_opt_count > 0)
diff --git a/lib/tests/igt_conflicting_args.c b/lib/tests/igt_conflicting_args.c
new file mode 100644
index 00000000..c357b6c5
--- /dev/null
+++ b/lib/tests/igt_conflicting_args.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright © 2019 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/*
+ * DESCRIPTION: Make sure that IGT framework complains when test try to define
+ * conflicting options.
+ */
+
+#include <signal.h>
+#include <sys/wait.h>
+#include <errno.h>
+
+#include "drmtest.h"
+#include "igt_core.h"
+#include "igt_tests_common.h"
+
+static struct option long_options[2];
+static const char *short_options;
+
+static int opt_handler(int option, int option_index, void *input)
+{
+
+ return 0;
+}
+
+static int do_fork(void)
+{
+ char test_name[] = "test";
+
+ char *argv[] = { test_name };
+ int argc = ARRAY_SIZE(argv);
+
+ pid_t pid = fork();
+ internal_assert(pid != -1);
+
+ if (pid) {
+ int status;
+ while (waitpid(pid, &status, 0) == -1 && errno == EINTR)
+ ;
+
+ return status;
+ }
+
+
+ igt_subtest_init_parse_opts(&argc, argv, short_options, long_options,
+ "", opt_handler, NULL);
+ igt_subtest("dummy") {}
+ igt_exit();
+}
+
+int main(int argc, char **argv)
+{
+ /* no conflict */
+ long_options[0] = (struct option) { "iterations", required_argument, NULL, 'i'};
+ short_options = "";
+ internal_assert_wexited(do_fork(), 0);
+
+ /* conflict on short option */
+ long_options[0] = (struct option) { "iterations", required_argument, NULL, 'i'};
+ short_options = "h";
+ internal_assert_wsignaled(do_fork(), SIGABRT);
+
+ /* conflict on long option name */
+ long_options[0] = (struct option) { "help", required_argument, NULL, 'i'};
+ short_options = "";
+ internal_assert_wsignaled(do_fork(), SIGABRT);
+
+ /* conflict on long option 'val' representation vs short option */
+ long_options[0] = (struct option) { "iterations", required_argument, NULL, 'h'};
+ short_options = "";
+ internal_assert_wsignaled(do_fork(), SIGABRT);
+
+ /* conflict on long option 'val' representations */
+ long_options[0] = (struct option) { "iterations", required_argument, NULL, 0};
+ short_options = "";
+ internal_assert_wsignaled(do_fork(), SIGABRT);
+
+ return 0;
+}
diff --git a/lib/tests/meson.build b/lib/tests/meson.build
index 74efce39..9950bd59 100644
--- a/lib/tests/meson.build
+++ b/lib/tests/meson.build
@@ -2,6 +2,7 @@ lib_tests = [
'igt_assert',
'igt_can_fail',
'igt_can_fail_simple',
+ 'igt_conflicting_args',
'igt_exit_handler',
'igt_fork',
'igt_fork_helper',
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 4+ messages in thread* [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_core: Rework extra options conflicts handling
2019-05-16 13:02 [igt-dev] [PATCH i-g-t] lib/igt_core: Rework extra options conflicts handling Arkadiusz Hiler
@ 2019-05-16 14:25 ` Patchwork
2019-05-16 16:44 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-05-23 7:46 ` [igt-dev] [PATCH i-g-t] " Petri Latvala
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2019-05-16 14:25 UTC (permalink / raw)
To: Arkadiusz Hiler; +Cc: igt-dev
== Series Details ==
Series: lib/igt_core: Rework extra options conflicts handling
URL : https://patchwork.freedesktop.org/series/60715/
State : success
== Summary ==
CI Bug Log - changes from IGT_4994 -> IGTPW_2989
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/60715/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2989 that come from known issues:
### IGT changes ###
#### Possible fixes ####
* igt@gem_basic@bad-close:
- {fi-icl-u3}: [INCOMPLETE][1] ([fdo#107713]) -> [PASS][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/fi-icl-u3/igt@gem_basic@bad-close.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/fi-icl-u3/igt@gem_basic@bad-close.html
* igt@gem_cpu_reloc@basic:
- fi-icl-u2: [INCOMPLETE][3] ([fdo#107713] / [fdo#110246]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/fi-icl-u2/igt@gem_cpu_reloc@basic.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/fi-icl-u2/igt@gem_cpu_reloc@basic.html
* igt@gem_exec_suspend@basic-s4-devices:
- fi-blb-e6850: [INCOMPLETE][5] ([fdo#107718]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/fi-blb-e6850/igt@gem_exec_suspend@basic-s4-devices.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/fi-blb-e6850/igt@gem_exec_suspend@basic-s4-devices.html
#### Warnings ####
* igt@i915_selftest@live_hangcheck:
- fi-apl-guc: [DMESG-FAIL][7] ([fdo#110620]) -> [FAIL][8] ([fdo#110623])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/fi-apl-guc/igt@i915_selftest@live_hangcheck.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/fi-apl-guc/igt@i915_selftest@live_hangcheck.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#110246]: https://bugs.freedesktop.org/show_bug.cgi?id=110246
[fdo#110620]: https://bugs.freedesktop.org/show_bug.cgi?id=110620
[fdo#110623]: https://bugs.freedesktop.org/show_bug.cgi?id=110623
Participating hosts (52 -> 45)
------------------------------
Missing (7): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-bdw-samus
Build changes
-------------
* IGT: IGT_4994 -> IGTPW_2989
CI_DRM_6090: df27ebbc9ec0d8ae42e8cf3d7a3b29fd6baf4940 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2989: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/
IGT_4994: 555019f862c35f1619627761d6da21385be40920 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 4+ messages in thread* [igt-dev] ✓ Fi.CI.IGT: success for lib/igt_core: Rework extra options conflicts handling
2019-05-16 13:02 [igt-dev] [PATCH i-g-t] lib/igt_core: Rework extra options conflicts handling Arkadiusz Hiler
2019-05-16 14:25 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2019-05-16 16:44 ` Patchwork
2019-05-23 7:46 ` [igt-dev] [PATCH i-g-t] " Petri Latvala
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2019-05-16 16:44 UTC (permalink / raw)
To: Arkadiusz Hiler; +Cc: igt-dev
== Series Details ==
Series: lib/igt_core: Rework extra options conflicts handling
URL : https://patchwork.freedesktop.org/series/60715/
State : success
== Summary ==
CI Bug Log - changes from IGT_4994_full -> IGTPW_2989_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/60715/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2989_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_eio@unwedge-stress:
- shard-snb: [PASS][1] -> [FAIL][2] ([fdo#109661])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-snb6/igt@gem_eio@unwedge-stress.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-snb2/igt@gem_eio@unwedge-stress.html
* igt@gem_tiled_swapping@non-threaded:
- shard-glk: [PASS][3] -> [DMESG-WARN][4] ([fdo#108686])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-glk5/igt@gem_tiled_swapping@non-threaded.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-glk5/igt@gem_tiled_swapping@non-threaded.html
* igt@i915_pm_rps@reset:
- shard-apl: [PASS][5] -> [FAIL][6] ([fdo#102250])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-apl7/igt@i915_pm_rps@reset.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-apl3/igt@i915_pm_rps@reset.html
- shard-iclb: [PASS][7] -> [FAIL][8] ([fdo#102250] / [fdo#108059])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-iclb8/igt@i915_pm_rps@reset.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-iclb6/igt@i915_pm_rps@reset.html
* igt@i915_suspend@fence-restore-untiled:
- shard-kbl: [PASS][9] -> [DMESG-WARN][10] ([fdo#108566])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-kbl2/igt@i915_suspend@fence-restore-untiled.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-kbl7/igt@i915_suspend@fence-restore-untiled.html
* igt@i915_suspend@forcewake:
- shard-apl: [PASS][11] -> [DMESG-WARN][12] ([fdo#108566]) +1 similar issue
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-apl3/igt@i915_suspend@forcewake.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-apl1/igt@i915_suspend@forcewake.html
* igt@kms_cursor_legacy@cursor-vs-flip-atomic:
- shard-hsw: [PASS][13] -> [FAIL][14] ([fdo#103355])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-hsw4/igt@kms_cursor_legacy@cursor-vs-flip-atomic.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-hsw1/igt@kms_cursor_legacy@cursor-vs-flip-atomic.html
* igt@kms_dp_dsc@basic-dsc-enable-edp:
- shard-iclb: [PASS][15] -> [SKIP][16] ([fdo#109349])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-iclb2/igt@kms_dp_dsc@basic-dsc-enable-edp.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-iclb1/igt@kms_dp_dsc@basic-dsc-enable-edp.html
* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-pwrite:
- shard-iclb: [PASS][17] -> [FAIL][18] ([fdo#103167]) +1 similar issue
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-iclb4/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-pwrite.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-iclb6/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-pwrite.html
* igt@kms_plane_lowres@pipe-a-tiling-y:
- shard-iclb: [PASS][19] -> [FAIL][20] ([fdo#103166])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-iclb7/igt@kms_plane_lowres@pipe-a-tiling-y.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-iclb6/igt@kms_plane_lowres@pipe-a-tiling-y.html
* igt@kms_psr@psr2_sprite_plane_onoff:
- shard-iclb: [PASS][21] -> [SKIP][22] ([fdo#109441])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-iclb2/igt@kms_psr@psr2_sprite_plane_onoff.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-iclb6/igt@kms_psr@psr2_sprite_plane_onoff.html
* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-kbl: [PASS][23] -> [FAIL][24] ([fdo#109016])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-kbl2/igt@kms_rotation_crc@multiplane-rotation-cropping-top.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-kbl7/igt@kms_rotation_crc@multiplane-rotation-cropping-top.html
* igt@kms_universal_plane@universal-plane-pipe-a-functional:
- shard-apl: [PASS][25] -> [FAIL][26] ([fdo#110037])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-apl2/igt@kms_universal_plane@universal-plane-pipe-a-functional.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-apl5/igt@kms_universal_plane@universal-plane-pipe-a-functional.html
- shard-kbl: [PASS][27] -> [FAIL][28] ([fdo#110037])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-kbl6/igt@kms_universal_plane@universal-plane-pipe-a-functional.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-kbl3/igt@kms_universal_plane@universal-plane-pipe-a-functional.html
* igt@perf@short-reads:
- shard-kbl: [PASS][29] -> [FAIL][30] ([fdo#103183])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-kbl2/igt@perf@short-reads.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-kbl2/igt@perf@short-reads.html
#### Possible fixes ####
* igt@i915_pm_rc6_residency@rc6-accuracy:
- shard-snb: [SKIP][31] ([fdo#109271]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-snb5/igt@i915_pm_rc6_residency@rc6-accuracy.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-snb5/igt@i915_pm_rc6_residency@rc6-accuracy.html
* igt@kms_frontbuffer_tracking@fbcpsr-1p-pri-indfb-multidraw:
- shard-iclb: [FAIL][33] ([fdo#103167]) -> [PASS][34] +2 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-iclb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-pri-indfb-multidraw.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-iclb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-pri-indfb-multidraw.html
* igt@kms_setmode@basic:
- shard-kbl: [FAIL][35] ([fdo#99912]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-kbl4/igt@kms_setmode@basic.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-kbl6/igt@kms_setmode@basic.html
* igt@kms_sysfs_edid_timing:
- shard-iclb: [FAIL][37] ([fdo#100047]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-iclb3/igt@kms_sysfs_edid_timing.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-iclb5/igt@kms_sysfs_edid_timing.html
* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-apl: [DMESG-WARN][39] ([fdo#108566]) -> [PASS][40] +6 similar issues
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-apl3/igt@kms_vblank@pipe-c-ts-continuation-suspend.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-apl1/igt@kms_vblank@pipe-c-ts-continuation-suspend.html
* igt@perf_pmu@rc6-runtime-pm-long:
- shard-apl: [FAIL][41] ([fdo#105010]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-apl5/igt@perf_pmu@rc6-runtime-pm-long.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-apl8/igt@perf_pmu@rc6-runtime-pm-long.html
- shard-kbl: [FAIL][43] ([fdo#105010]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-kbl6/igt@perf_pmu@rc6-runtime-pm-long.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-kbl6/igt@perf_pmu@rc6-runtime-pm-long.html
#### Warnings ####
* igt@gem_mmap_gtt@forked-big-copy-odd:
- shard-iclb: [TIMEOUT][45] ([fdo#109673]) -> [INCOMPLETE][46] ([fdo#107713] / [fdo#109100])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4994/shard-iclb5/igt@gem_mmap_gtt@forked-big-copy-odd.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/shard-iclb2/igt@gem_mmap_gtt@forked-big-copy-odd.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
[fdo#102250]: https://bugs.freedesktop.org/show_bug.cgi?id=102250
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103183]: https://bugs.freedesktop.org/show_bug.cgi?id=103183
[fdo#103355]: https://bugs.freedesktop.org/show_bug.cgi?id=103355
[fdo#105010]: https://bugs.freedesktop.org/show_bug.cgi?id=105010
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108059]: https://bugs.freedesktop.org/show_bug.cgi?id=108059
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109016]: https://bugs.freedesktop.org/show_bug.cgi?id=109016
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661
[fdo#109673]: https://bugs.freedesktop.org/show_bug.cgi?id=109673
[fdo#110037]: https://bugs.freedesktop.org/show_bug.cgi?id=110037
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
Participating hosts (7 -> 6)
------------------------------
Missing (1): shard-skl
Build changes
-------------
* IGT: IGT_4994 -> IGTPW_2989
CI_DRM_6090: df27ebbc9ec0d8ae42e8cf3d7a3b29fd6baf4940 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2989: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/
IGT_4994: 555019f862c35f1619627761d6da21385be40920 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2989/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [igt-dev] [PATCH i-g-t] lib/igt_core: Rework extra options conflicts handling
2019-05-16 13:02 [igt-dev] [PATCH i-g-t] lib/igt_core: Rework extra options conflicts handling Arkadiusz Hiler
2019-05-16 14:25 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-05-16 16:44 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2019-05-23 7:46 ` Petri Latvala
2 siblings, 0 replies; 4+ messages in thread
From: Petri Latvala @ 2019-05-23 7:46 UTC (permalink / raw)
To: Arkadiusz Hiler; +Cc: igt-dev
On Thu, May 16, 2019 at 04:02:29PM +0300, Arkadiusz Hiler wrote:
> This started simple, as a fixup for a warning:
> In file included from ../lib/drmtest.h:39,
> from ../lib/igt_core.c:60:
> ../lib/igt_core.c: In function ‘common_init’:
> ../lib/igt_core.h:891:24: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
> 891 | #define igt_warn(f...) igt_log(IGT_LOG_DOMAIN, IGT_LOG_WARN, f)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../lib/igt_core.c:704:4: note: in expansion of macro ‘igt_warn’
> 704 | igt_warn("Conflicting long and short option values between --%s and -%s\n",
> | ^~~~~~~~
> ../lib/igt_core.c:704:73: note: format string is defined here
> 704 | igt_warn("Conflicting long and short option values between --%s and -%s\n",
> | ^~
>
> But it ended up doing the following things:
> 1. Promote all igt_warns to _critical and assert afterwards.
> 2. Use for loop instead of a while-doing-for's-job.
> 3. Streamline calculation of the option list sizes.
> 4. Add checks for long option names.
> 5. Log about "'val' representation" instead of confusing "value".
> 6. Log correct things so we won't %s on a NULL.
> 7. Write tests to confirm that it works.
>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
> lib/igt_core.c | 72 +++++++++++++----------
> lib/tests/igt_conflicting_args.c | 99 ++++++++++++++++++++++++++++++++
> lib/tests/meson.build | 1 +
> 3 files changed, 141 insertions(+), 31 deletions(-)
> create mode 100644 lib/tests/igt_conflicting_args.c
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index d5d4fce2..6bbc805c 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -666,12 +666,12 @@ static int common_init(int *argc, char **argv,
> {
> int c, option_index = 0, i, x;
> static struct option long_options[] = {
> - {"list-subtests", 0, 0, OPT_LIST_SUBTESTS},
> - {"run-subtest", 1, 0, OPT_RUN_SUBTEST},
> - {"help-description", 0, 0, OPT_DESCRIPTION},
> - {"debug", optional_argument, 0, OPT_DEBUG},
> - {"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> - {"help", 0, 0, OPT_HELP},
> + {"list-subtests", no_argument, NULL, OPT_LIST_SUBTESTS},
> + {"run-subtest", required_argument, NULL, OPT_RUN_SUBTEST},
> + {"help-description", no_argument, NULL, OPT_DESCRIPTION},
> + {"debug", optional_argument, NULL, OPT_DEBUG},
> + {"interactive-debug", optional_argument, NULL, OPT_INTERACTIVE_DEBUG},
> + {"help", no_argument, NULL, OPT_HELP},
> {0, 0, 0, 0}
> };
> char *short_opts;
> @@ -687,48 +687,58 @@ static int common_init(int *argc, char **argv,
> if (strrchr(command_str, '/'))
> command_str = strrchr(command_str, '/') + 1;
>
> - /* First calculate space for all passed-in extra long options */
> - all_opt_count = 0;
> - while (extra_long_opts && extra_long_opts[all_opt_count].name) {
> + /* Check for conflicts and calculate space for passed-in extra long options */
> + for (extra_opt_count = 0; extra_long_opts && extra_long_opts[extra_opt_count].name; extra_opt_count++) {
> + char *conflicting_char;
>
> /* check for conflicts with standard long option values */
> - for (i = 0; long_options[i].name; i++)
> - if (extra_long_opts[all_opt_count].val == long_options[i].val)
> - igt_warn("Conflicting long option values between --%s and --%s\n",
> - extra_long_opts[all_opt_count].name,
> + for (i = 0; long_options[i].name; i++) {
> + if (0 == strcmp(extra_long_opts[extra_opt_count].name, long_options[i].name)) {
> + igt_critical("Conflicting extra long option defined --%s\n", long_options[i].name);
> + assert(0);
> +
> + }
> +
> + if (extra_long_opts[extra_opt_count].val == long_options[i].val) {
> + igt_critical("Conflicting long option 'val' representation between --%s and --%s\n",
> + extra_long_opts[extra_opt_count].name,
> long_options[i].name);
Indentation here looks funky.
> -
> - /* check for conflicts with short options */
> - if (extra_long_opts[all_opt_count].val != ':'
> - && strchr(std_short_opts, extra_long_opts[all_opt_count].val)) {
> - igt_warn("Conflicting long and short option values between --%s and -%s\n",
> - extra_long_opts[all_opt_count].name,
> - long_options[i].name);
> + assert(0);
> + }
> }
>
> -
> - all_opt_count++;
> + /* check for conflicts with standard short options */
> + if (extra_long_opts[extra_opt_count].val != ':'
> + && (conflicting_char = strchr(std_short_opts, extra_long_opts[extra_opt_count].val))) {
> + igt_critical("Conflicting long and short option 'val' representation between --%s and -%c\n",
> + extra_long_opts[extra_opt_count].name,
> + *conflicting_char);
Indentation funky here as well.
Otherwise LGTM. Thanks for doing this, this is a great help in my
upcoming series that touches testdisplay among other things...
Reviewed-by: Petri Latvala <petri.latvala@intel.com>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-23 7:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-16 13:02 [igt-dev] [PATCH i-g-t] lib/igt_core: Rework extra options conflicts handling Arkadiusz Hiler
2019-05-16 14:25 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-05-16 16:44 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-05-23 7:46 ` [igt-dev] [PATCH i-g-t] " Petri Latvala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox