Skip to contentSkip to conversation

Policy regarding BASH

LTP Stanislav Kholmanskikh 3 participants 4 messages Sep 19, 2013 – Oct 14, 2013

lore
Share & tools
lore
#0 lore raw

Hi!

During looking into shell testcases I came across a situation where
* main shell script is a bash script (ie it has #!/bin/bash in the header)
* for each testcase number main shell script executes a separate (child) shell-script which has #!/bin/sh in the header

So If I try to run main script on Debian (where /bin/sh points to /bin/dash) I get error like this:

root@debian7-x64:/opt/ltp/testcases/bin# ./run_cpuset_test.sh 3
TEST 3: CPUSET CONTROLLER TESTING
TEST STARTED: Please avoid using system while this test executes
./cpuset_exclusive_test.sh: 34: ./cpuset_funcs.sh: arithmetic 
expression: expecting primary: "N_NODES++"

So what is the policy regarding bash presence in LTP? Is it permitted to write testcases using bash specific features?
Or are we strongly encouraged to use "common shell" only?

And how should I proceed with this particular testcase? Try to remove "bashism" or just change header of child scripts from "#!/bin/sh" to "#!/bin/bash"?

Thank you.

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 19 lines · Stanislav Kholmanskikh

Hi!

During looking into shell testcases I came across a situation where
* main shell script is a bash script (ie it has #!/bin/bash in the header)
* for each testcase number main shell script executes a separate (child) shell-script which has #!/bin/sh in the header

So If I try to run main script on Debian (where /bin/sh points to /bin/dash) I get error like this:

root@debian7-x64:/opt/ltp/testcases/bin# ./run_cpuset_test.sh 3
TEST 3: CPUSET CONTROLLER TESTING
TEST STARTED: Please avoid using system while this test executes
./cpuset_exclusive_test.sh: 34: ./cpuset_funcs.sh: arithmetic
expression: expecting primary: "N_NODES++"

So what is the policy regarding bash presence in LTP? Is it permitted to write testcases using bash specific features?
Or are we strongly encouraged to use "common shell" only?

Quoted 5 lines

And how should I proceed with this particular testcase? Try to remove "bashism" or just change header of child scripts from "#!/bin/sh" to "#!/bin/bash"?

Thank you.

The problem is not because child is a "sh" script but because child includes cpuset_funcs.sh file (main includes it also) but this file has bash-specific things.

Quoted 5 lines
Quoted 10 lines

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
In reply to Stanislav Kholmanskikh

Hi!

Quoted 3 lines

So what is the policy regarding bash presence in LTP? Is it permitted to write testcases using bash specific features?
Or are we strongly encouraged to use "common shell" only?

Just fix the tests to work with common shell and send a patch.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#3 lore raw
Quoted 5 lines · On Thursday 19 September 2013 09:40:50 [email protected] wrote:
Quoted 3 lines

So what is the policy regarding bash presence in LTP? Is it permitted to write testcases using bash specific features?
Or are we strongly encouraged to use "common shell" only?

Just fix the tests to work with common shell and send a patch.

and please do not do it blindly. running checkbashisms is known to produce false positives.
-mike

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list