* [dtc] Remove another bashism from run_tests.sh
@ 2010-08-30 2:53 David Gibson
2010-08-30 3:22 ` Grant Likely
2010-09-20 14:33 ` Jon Loeliger
0 siblings, 2 replies; 3+ messages in thread
From: David Gibson @ 2010-08-30 2:53 UTC (permalink / raw)
To: Jon Loeliger; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
Current we check for various error codes with [ $x == "NN" ]. However
'==' is not actually a correct operator for the [ (test) command. It
should be either '=' for string comparison or '-eq' for integer
comparison. It appears that the bash builtin version of test
implements '==' though, so we were getting away with it, as long as
/bin/sh was bash - or the testsuite generated no errors.
This patch fixes the usage of test so that it should work on non-bash
shells.
Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2010-08-30 12:43:03.133784380 +1000
+++ dtc/tests/run_tests.sh 2010-08-30 12:43:34.741770203 +1000
@@ -24,11 +24,11 @@ base_run_test() {
tot_pass=$((tot_pass + 1))
else
ret="$?"
- if [ "$ret" == "1" ]; then
+ if [ "$ret" -eq 1 ]; then
tot_config=$((tot_config + 1))
- elif [ "$ret" == "2" ]; then
+ elif [ "$ret" -eq 2 ]; then
tot_fail=$((tot_fail + 1))
- elif [ "$ret" == "$VGCODE" ]; then
+ elif [ "$ret" -eq $VGCODE ]; then
tot_vg=$((tot_vg + 1))
else
tot_strange=$((tot_strange + 1))
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [dtc] Remove another bashism from run_tests.sh
2010-08-30 2:53 [dtc] Remove another bashism from run_tests.sh David Gibson
@ 2010-08-30 3:22 ` Grant Likely
2010-09-20 14:33 ` Jon Loeliger
1 sibling, 0 replies; 3+ messages in thread
From: Grant Likely @ 2010-08-30 3:22 UTC (permalink / raw)
To: David Gibson; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
[-- Attachment #1.1: Type: text/plain, Size: 1810 bytes --]
Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
On Aug 29, 2010 8:53 PM, "David Gibson" <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> wrote:
> Current we check for various error codes with [ $x == "NN" ]. However
> '==' is not actually a correct operator for the [ (test) command. It
> should be either '=' for string comparison or '-eq' for integer
> comparison. It appears that the bash builtin version of test
> implements '==' though, so we were getting away with it, as long as
> /bin/sh was bash - or the testsuite generated no errors.
>
> This patch fixes the usage of test so that it should work on non-bash
> shells.
>
> Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
>
> Index: dtc/tests/run_tests.sh
> ===================================================================
> --- dtc.orig/tests/run_tests.sh 2010-08-30 12:43:03.133784380 +1000
> +++ dtc/tests/run_tests.sh 2010-08-30 12:43:34.741770203 +1000
> @@ -24,11 +24,11 @@ base_run_test() {
> tot_pass=$((tot_pass + 1))
> else
> ret="$?"
> - if [ "$ret" == "1" ]; then
> + if [ "$ret" -eq 1 ]; then
> tot_config=$((tot_config + 1))
> - elif [ "$ret" == "2" ]; then
> + elif [ "$ret" -eq 2 ]; then
> tot_fail=$((tot_fail + 1))
> - elif [ "$ret" == "$VGCODE" ]; then
> + elif [ "$ret" -eq $VGCODE ]; then
> tot_vg=$((tot_vg + 1))
> else
> tot_strange=$((tot_strange + 1))
>
> --
> David Gibson | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
> | _way_ _around_!
> http://www.ozlabs.org/~dgibson
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
[-- Attachment #1.2: Type: text/html, Size: 2796 bytes --]
[-- Attachment #2: Type: text/plain, Size: 192 bytes --]
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [dtc] Remove another bashism from run_tests.sh
2010-08-30 2:53 [dtc] Remove another bashism from run_tests.sh David Gibson
2010-08-30 3:22 ` Grant Likely
@ 2010-09-20 14:33 ` Jon Loeliger
1 sibling, 0 replies; 3+ messages in thread
From: Jon Loeliger @ 2010-09-20 14:33 UTC (permalink / raw)
To: David Gibson; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
> Current we check for various error codes with [ $x == "NN" ]. However
> '==' is not actually a correct operator for the [ (test) command. It
> should be either '=' for string comparison or '-eq' for integer
> comparison. It appears that the bash builtin version of test
> implements '==' though, so we were getting away with it, as long as
> /bin/sh was bash - or the testsuite generated no errors.
>
> This patch fixes the usage of test so that it should work on non-bash
> shells.
>
> Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
Applied. Sorry for the delay.
Thanks,
jdl
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-20 14:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-30 2:53 [dtc] Remove another bashism from run_tests.sh David Gibson
2010-08-30 3:22 ` Grant Likely
2010-09-20 14:33 ` Jon Loeliger
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.