Bug 1232

Summary: dot11s regression test sets incorrect NS_TEST_SOURCEDIR via SetDataDir
Product: ns-3 Reporter: Mitch Watrous <watrous>
Component: test frameworkAssignee: Mathieu Lacage <mathieu.lacage>
Status: RESOLVED FIXED    
Severity: normal CC: john.abraham.in, ns-bugs, tomh
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   

Description Mitch Watrous 2011-08-02 18:30:34 UTC
If the Buildbots are failing, it may be because the pcap trace files have changed.
Comment 1 Mitch Watrous 2011-08-02 18:37:03 UTC
Note that test.py can now be used to generate pcap trace files automatically as follows:

    ./test.py --update-data

Doing that fixed this bug.
Comment 2 Mitch Watrous 2011-08-02 18:38:00 UTC
Bug closed.

ns-3-dev changeset:  c11cc91c3a16
Comment 3 Mitch Watrous 2011-08-02 20:13:45 UTC
I spoke too fast.

The pcap files on generated on my machine (and checked in to the repository) don't work on darwin.

Here is the test that is still failing on darwin:

    FAIL: TestSuite devices-mesh-dot11s-regression
Comment 4 John Abraham 2011-08-05 15:53:57 UTC
The problem appears to be related to the fact that for dot11s,
SetDataDir (NS_TEST_SOURCEDIR) is setting the path for "flame" rather than "dot11s".

Resulting in picking up the pcap from the wrong location for dot11s tests

(In reply to comment #3)
> I spoke too fast.
> 
> The pcap files on generated on my machine (and checked in to the repository)
> don't work on darwin.
> 
> Here is the test that is still failing on darwin:
> 
>     FAIL: TestSuite devices-mesh-dot11s-regression
Comment 5 Tom Henderson 2011-08-08 00:58:02 UTC
(In reply to comment #4)
> The problem appears to be related to the fact that for dot11s,
> SetDataDir (NS_TEST_SOURCEDIR) is setting the path for "flame" rather than
> "dot11s".

I agree.  The current means for setting NS_TEST_SOURCEDIR is a bit fragile and sets it to the directory of the last .cc file found.  Here, we have a few sub-directories in src/mesh/test and it just picks the last one which happens to be 'flame'.  

A few options to try to solve this:
1) do not allow src/*/test subdirectories
2) hardcode SetDataDir() in these tests to point to the right subdirectory, rather than use NS_TEST_SOURCEDIR
3) try to make SetDataDir/NS_TEST_SOURCEDIR to handle multiple test subdirectories and search through them all
Comment 6 Tom Henderson 2011-08-08 12:23:50 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > The problem appears to be related to the fact that for dot11s,
> > SetDataDir (NS_TEST_SOURCEDIR) is setting the path for "flame" rather than
> > "dot11s".
> 
> I agree.  The current means for setting NS_TEST_SOURCEDIR is a bit fragile and
> sets it to the directory of the last .cc file found.  Here, we have a few
> sub-directories in src/mesh/test and it just picks the last one which happens
> to be 'flame'.  
> 
> A few options to try to solve this:
> 1) do not allow src/*/test subdirectories
> 2) hardcode SetDataDir() in these tests to point to the right subdirectory,
> rather than use NS_TEST_SOURCEDIR
> 3) try to make SetDataDir/NS_TEST_SOURCEDIR to handle multiple test
> subdirectories and search through them all

I just chose option 2 above, and added some documentation about this limitation to the use of NS_TEST_SOURCEDIR.  Here is the changeset:
http://code.nsnam.org/ns-3-dev/rev/ef4818bb81bc

I will close, but if someone feels this solution is inadequate, please reopen and suggest the next steps.