Skip to contentSkip to conversation

igt_command_line.sh: Fix bashism

PATCH In review Petri Latvala 5 participants 8 messages Sep 25, 2017 – Oct 2, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igt_command_line.sh: Fix bashism

[[ a != b ]] is a bashism. As it's just comparing $1 to an empty string, use -n with a normal [ ].

/bin/sh is dash in CI.

Fixes f0243a761f1b ("tests/igt_command_line.sh: Allow testing individual tests")
CC Daniel Vetter <[email protected]>
---
 tests/igt_command_line.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/igt_command_line.sh +1 -1
index 57d105e9..a8baaaa1 100755
@@ -112,7 +112,7 @@ if [ $? -ne 0 ]; then
 	exit 99
 fi
 
-if [[ "$1" != "" ]] ; then
+if [ -n "$1" ] ; then
 	check_test $1
 	exit 0
 fi
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for igt_command_line.sh: Fix bashism

== Series Details ==

== Series Details ==

Series: igt_command_line.sh: Fix bashism
URL : https://patchwork.freedesktop.org/series/30826/
State : success

== Summary ==

IGT patchset tested on top of latest successful build f16a799807487b6e2dcc8c7940a1a8b424f10802 igt_core: Rework igt_system()

with latest DRM-Tip kernel build CI_DRM_3128
47916f134a9c drm-tip: 2017y-09m-25d-09h-31m-48s UTC integration manifest

Test kms_pipe_crc_basic:

        Subgroup read-crc-pipe-b:
                incomplete -> DMESG-WARN (fi-cfl-s) fdo#102294
Test drv_module_reload:
        Subgroup basic-reload-inject:
                dmesg-warn -> PASS       (fi-glk-1) fdo#102777

fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294
fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:444s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:469s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:419s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:524s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:279s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:508s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:500s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:499s
fi-cfl-s         total:289  pass:223  dwarn:34  dfail:0   fail:0   skip:32  time:547s
fi-cnl-y         total:289  pass:256  dwarn:0   dfail:0   fail:6   skip:27  time:664s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:416s
fi-glk-1         total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:567s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:426s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:403s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:438s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:495s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:461s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:475s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:576s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:589s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:542s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:453s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:754s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:491s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:472s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:565s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:436s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_247/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Petri Latvala
Quoted 4 lines · Petri Latvala

[[ a != b ]] is a bashism. As it's just comparing $1 to an empty string, use -n with a normal [ ].

/bin/sh is dash in CI.

There's probably /bin/bash around anyway, but I'm tired of fighting the fight. So never mind about that.

You could add shellcheck to your static checks, with a list of exceptions of shellcheck tests you don't care about. It would tell you,

In igt_command_line.sh line 115:
if [[ "$1" != "" ]] ; then
^-- SC2039: In POSIX sh, [[ ]] is undefined.

BR,
Jani.

Quoted 21 lines
Fixes f0243a761f1b ("tests/igt_command_line.sh: Allow testing individual tests")
CC Daniel Vetter <[email protected]>
---
 tests/igt_command_line.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/igt_command_line.sh +1 -1
index 57d105e9..a8baaaa1 100755
@@ -112,7 +112,7 @@ if [ $? -ne 0 ]; then
 	exit 99
 fi
 
-if [[ "$1" != "" ]] ; then
+if [ -n "$1" ] ; then
 	check_test $1
 	exit 0
 fi
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 8 lines · Jani Nikula
Quoted 4 lines · Petri Latvala

[[ a != b ]] is a bashism. As it's just comparing $1 to an empty string, use -n with a normal [ ].

/bin/sh is dash in CI.

There's probably /bin/bash around anyway, but I'm tired of fighting the fight. So never mind about that.

Yeah, let's just switch to /bin/bash and stop bothering with dash. At least I don't see any value in trying to be posix compliant, we're not going to run on anything that doesn't have bash anyway. -Daniel

Quoted 37 lines

You could add shellcheck to your static checks, with a list of exceptions of shellcheck tests you don't care about. It would tell you,

In igt_command_line.sh line 115:
if [[ "$1" != "" ]] ; then
^-- SC2039: In POSIX sh, [[ ]] is undefined.

BR,
Jani.

Quoted 21 lines
Fixes f0243a761f1b ("tests/igt_command_line.sh: Allow testing individual tests")
CC Daniel Vetter <[email protected]>
---
 tests/igt_command_line.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/igt_command_line.sh +1 -1
index 57d105e9..a8baaaa1 100755
@@ -112,7 +112,7 @@ if [ $? -ne 0 ]; then
 	exit 99
 fi
 
-if [[ "$1" != "" ]] ; then
+if [ -n "$1" ] ; then
 	check_test $1
 	exit 0
 fi
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 5 lines · Daniel Vetter
Quoted 4 lines · Jani Nikula
Quoted 3 lines · Petri Latvala

[[ a != b ]] is a bashism. As it's just comparing $1 to an empty string, use -n with a normal [ ].

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

/bin/sh is dash in CI.

There's probably /bin/bash around anyway, but I'm tired of fighting the fight. So never mind about that.

Yeah, let's just switch to /bin/bash and stop bothering with dash. At least I don't see any value in trying to be posix compliant, we're not going to run on anything that doesn't have bash anyway.

This script is used only on build-time anyway so the shebang doesn't really matter much.

I made the shebang use /bin/bash in v2 (in addition to the changes in v1) so it doesn't need further handholding and pushed with an IRC ack from Daniel.

Signature · 5 lines
Petri Latvala
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by
#5 lore raw
In reply to Daniel Vetter
Quoted 5 lines · Daniel Vetter
Quoted 4 lines · Jani Nikula
Quoted 3 lines · Petri Latvala

[[ a != b ]] is a bashism. As it's just comparing $1 to an empty string, use -n with a normal [ ].

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

/bin/sh is dash in CI.

There's probably /bin/bash around anyway, but I'm tired of fighting the fight. So never mind about that.

Yeah, let's just switch to /bin/bash and stop bothering with dash. At least I don't see any value in trying to be posix compliant, we're not going to run on anything that doesn't have bash anyway.

I'm actively running I-G-T with busybox sh, so please cut with the /bin/bash stuff, it's not that hard to be POSIX compliant.

Original patch is;

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 11 lines · Joonas Lahtinen
Quoted 10 lines · Daniel Vetter
Quoted 8 lines · Jani Nikula
Quoted 4 lines · Petri Latvala

[[ a != b ]] is a bashism. As it's just comparing $1 to an empty string, use -n with a normal [ ].

/bin/sh is dash in CI.

There's probably /bin/bash around anyway, but I'm tired of fighting the fight. So never mind about that.

Quoted 6 lines
Quoted 3 lines

Yeah, let's just switch to /bin/bash and stop bothering with dash. At least I don't see any value in trying to be posix compliant, we're not going to run on anything that doesn't have bash anyway.

I'm actively running I-G-T with busybox sh, so please cut with the /bin/bash stuff, it's not that hard to be POSIX compliant.

Is that a machine which doesn't have any bash at all, or is busysbox simply your /bin/sh?

And yes it's imo not justified to be posix compliant if there's no use-case for it, afaiui we haven't ever made a decision for igt to be posix compliant when building (running might be a different thing, with android and all that). And this is a build-time script here. -Daniel

Quoted 10 lines

Original patch is;

Regards, Joonas

Signature · 3 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

✗ Fi.CI.IGT: warning for igt_command_line.sh: Fix bashism

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: igt_command_line.sh: Fix bashism
URL : https://patchwork.freedesktop.org/series/30826/
State : warning

== Summary ==

Test prime_mmap:

        Subgroup test_userptr:
                dmesg-warn -> PASS       (shard-hsw) fdo#102939
Test perf:
        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-C-frame-sequence:
                pass       -> DMESG-WARN (shard-hsw)
Test gem_eio:
        Subgroup throttle:
                dmesg-warn -> PASS       (shard-hsw) fdo#102886

fdo#102939 https://bugs.freedesktop.org/show_bug.cgi?id=102939
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102886 https://bugs.freedesktop.org/show_bug.cgi?id=102886

shard-hsw total:2429 pass:1330 dwarn:5 dfail:0 fail:11 skip:1083 time:9908s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_247/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx