Bug 2903

Summary: test.py -l crashes if the path of ns-3 contains a space
Product: ns-3 Reporter: Jörg Christian Kirchhof <christian.kirchhof>
Component: test frameworkAssignee: ns-bugs <ns-bugs>
Status: PATCH WANTED ---    
Severity: normal CC: tomh
Priority: P3    
Version: ns-3.28   
Hardware: All   
OS: All   

Description Jörg Christian Kirchhof 2018-03-28 06:44:42 EDT
Overview: 
If the path where ns-3 lies on your computer contains a space, "./test.py -l" crashes.


Steps to Reproduce: 
1) Setup ns-3 in a folder whose path contains a space, e.g., "/Users/kirchhof/Mobile Documents/ns-allinone-3.28"
2) Go into the ns3 directory
3) Call "./waf configure --enable-examples --enable-tests"
4) Call "./waf build"
5) Call "./test.py -l"

Actual Results: 
The script crashes. The error message says:
"test.py error:  test-runner return code returned 127
To debug, try running './waf --run "test-runner --print-test-name-list"'"

However, calling "./waf --run "test-runner --print-test-name-list"" works fine.

Expected Results: 
A list of test-suites should be printed to the console.

Build Date & Hardware: 
ns-3.28 on Mac OS X High Sierra.

Additional Builds and Platforms: 
I also reproduced the issue using Ubuntu 16.04.3 LTS with ns-3.28.

Additional Information: 
The cause of the error is in line 766 of test.py. It says "proc = subprocess.Popen(cmd, shell = True, cwd = directory, stdout=subprocess.PIPE, stderr=subprocess.PIPE)". Everything after the first whitespace in cmd is treated as an argument. However, simply adding quotation marks to cmd is not an option because cmd contains the command and the arguments.