* [PATCH] Fix test script to run also on dash shell
@ 2022-06-29 16:32 Tero Tervala
[not found] ` <20220629163210.932198-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Tero Tervala @ 2022-06-29 16:32 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA; +Cc: Tero Tervala
/bin/sh points to dash instead of bash in some linux distros.
This fix allows test script to run on both.
Signed-off-by: Tero Tervala <tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
---
tests/run_tests.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index c78351d..1b16eb8 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -195,7 +195,7 @@ asm_to_so_test () {
run_fdtget_test () {
expect="$1"
shift
- printf "fdtget-runtest.sh %s $*: " "$(echo $expect)"
+ printf "fdtget-runtest.sh \"%s\" $*: " "$expect"
base_run_test sh "$SRCDIR/fdtget-runtest.sh" "$expect" "$@"
}
@@ -862,7 +862,7 @@ fdtget_tests () {
run_fdtget_test "61 62 63 0" -tbx $dtb /randomnode tricky1
run_fdtget_test "a b c d de ea ad be ef" -tbx $dtb /randomnode blob
run_fdtget_test "MyBoardName\0MyBoardFamilyName\0" -tr $dtb / compatible
- run_fdtget_test "\x0a\x0b\x0c\x0d\xde\xea\xad\xbe\xef" -tr $dtb /randomnode blob
+ run_fdtget_test "\012\013\014\015\336\352\255\276\357" -tr $dtb /randomnode blob
# Here the property size is not a multiple of 4 bytes, so it should fail
run_wrap_error_test $DTGET -tlx $dtb /randomnode mixed
--
2.33.3
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <20220629163210.932198-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] Fix test script to run also on dash shell [not found] ` <20220629163210.932198-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org> @ 2022-07-02 7:49 ` David Gibson 0 siblings, 0 replies; 2+ messages in thread From: David Gibson @ 2022-07-02 7:49 UTC (permalink / raw) To: Tero Tervala; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 2308 bytes --] On Wed, Jun 29, 2022 at 07:32:10PM +0300, Tero Tervala wrote: > /bin/sh points to dash instead of bash in some linux distros. > This fix allows test script to run on both. It would be helpful to explain here exactly what the dash incompatibility is. > > Signed-off-by: Tero Tervala <tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org> > --- > tests/run_tests.sh | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tests/run_tests.sh b/tests/run_tests.sh > index c78351d..1b16eb8 100755 > --- a/tests/run_tests.sh > +++ b/tests/run_tests.sh > @@ -195,7 +195,7 @@ asm_to_so_test () { > run_fdtget_test () { > expect="$1" > shift > - printf "fdtget-runtest.sh %s $*: " "$(echo $expect)" > + printf "fdtget-runtest.sh \"%s\" $*: " "$expect" Hrm, I'm not entirely sure what these changes are for. I think they're just about making the output clearer. AFAICT adding the \" is just cosmetic. IIUC, removing the echo means we'll display the string with the \ escapes, rather than the version interpreted by echo. Those changes seem reasonable, but it should be mentioned in the commit message. > base_run_test sh "$SRCDIR/fdtget-runtest.sh" "$expect" "$@" > } > > @@ -862,7 +862,7 @@ fdtget_tests () { > run_fdtget_test "61 62 63 0" -tbx $dtb /randomnode tricky1 > run_fdtget_test "a b c d de ea ad be ef" -tbx $dtb /randomnode blob > run_fdtget_test "MyBoardName\0MyBoardFamilyName\0" -tr $dtb / compatible > - run_fdtget_test "\x0a\x0b\x0c\x0d\xde\xea\xad\xbe\xef" -tr $dtb /randomnode blob > + run_fdtget_test "\012\013\014\015\336\352\255\276\357" -tr $dtb /randomnode blob AFAICT the actual problem is that dash's version of printf doesn't understand \x escapes. I hadn't actually realized that printf was a builtin, I'd assumed we were using /bin/printf, which does appear to understand \x escapes. This change itself looks fine. > > # Here the property size is not a multiple of 4 bytes, so it should fail > run_wrap_error_test $DTGET -tlx $dtb /randomnode mixed -- 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 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-02 7:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-29 16:32 [PATCH] Fix test script to run also on dash shell Tero Tervala
[not found] ` <20220629163210.932198-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
2022-07-02 7:49 ` David Gibson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).