|
Bugzilla – Full Text Bug Listing |
| Summary: | test-runner crashes running multiple tests | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Peter Barnes <pdbarnes> |
| Component: | core | Assignee: | Peter Barnes <pdbarnes> |
| Status: | RESOLVED WONTFIX | ||
| Severity: | normal | CC: | ns-bugs, tomh |
| Priority: | P3 | ||
| Version: | ns-3-dev | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Peter Barnes
2017-10-02 17:47:56 UTC
This is indeed a puzzle. After a quick look I agree with most of your summary of the execution paths, except for one point: while Simulator::Run *does* clear the marked times, I don’t see where *tests* call Simulator::Run. It that is indeed the case, then there shouldn’t be an issue with a test setting the resolution. I think we should modify execution so calling SetResolution a second time with the current resolution *does not* throw an exception; a no-op is a no-op, after all. But this will hide your assert, which indicates a real issue. I’m not sure what to suggest, other than watching g_markingTimes, and/or set breakpoints on all the relevant functions and examine the call stack on each hit. On Sep 5, 2017, at 6:18 PM, Ammon, Robert (ammo6818@vandals.uidaho.edu) <ammo6818@vandals.uidaho.edu> wrote: I explored this some more and here is the issue. Under Linux, ./test.py runs a new instance of test-runner for each test being executed. What I was doing on Windows was executing test-runner.exe with no parameters to execute every test. In this situation, SetResolution gets called by multiple test cases which looks to the Time class library and multiple calls to SetResolution within a single program (which it is). If I create a batch file to execute test-runner.exe once for each test case, I get the same behavior as under Linux. My follow on question is why does the implementation of the Time class set the value of g_markingTimes to null in ConvertTime and ClearMarkTimes? I assume that is to prevent SetResolution from being called more than once but I am not sure what's the reason for that implementation. On Sep 5, 2017, at 6:18 PM, Ammon, Robert (ammo6818@vandals.uidaho.edu) <ammo6818@vandals.uidaho.edu> wrote: > I explored this some more and here is the issue. > > Under Linux, ./test.py runs a new instance of test-runner for each test > being executed. > > What I was doing on Windows was executing test-runner.exe with no > parameters to execute every test. Ah, that explains it. > In this situation, SetResolution gets called by multiple test cases which > looks to the Time class library and multiple calls to SetResolution within a > single program (which it is). It looks like accepting SetResolution to the current resolution will only fix a few of those cases. I found Time::SetResolution here: attribute-test-suite.cc: Time::SetResolution (Time::NS); first.cc: Time::SetResolution (Time::NS); sample-log-time-format.cc: Time::SetResolution (search->second); time-test-suite.cc: Time::SetResolution (Time::PS); So only the first two would be safe. > If I create a batch file to execute test-runner.exe once for each test case, I > get the same behavior as under Linux. Yes, that will have to be the real solution. It would be nice if TestRunnerIpml could do something clever when running all tests, like print a warning, omit the tests with SetResolution, only run one of them (I’d vote for time-test-suite). Not obvious to to me how to do any of these. Perhaps add TestCase::SetsTimeResolution(void), to mark those tests? > My follow on question is why does the implementation of the Time class > set the value of g_markingTimes to null in ConvertTime and > ClearMarkTimes? I assume that is to prevent SetResolution from being > called more than once but I am not sure what's the reason for that i > mplementation. Since Time is used everywhere, we didn’t want the resolution option to slow things down while running. Therefore we only support changing the resolution during setup, and freeze the resolution during execution. The implementation mechanics are to set a flag, which happens to be a pointer, to indicate if we’re recording Time instances or not. Notice that the Time constructors all check that flag. Simulator::Run Time::SetResolution clear the flag. On Sep 28, 2017, at 10:21 AM, Tom Henderson <tomh@tomh.org> wrote: I'm not sure this was driven to resolution; do we need to open a Bugzilla issue to not forget about the details? On Sep 28, 2017, at 5:40 PM, Ammon, Robert (ammo6818@vandals.uidaho.edu) <ammo6818@vandals.uidaho.edu> wrote: This originally got written because when i tried to execute test-runner w/o any parameters in the Windows environment, it started throwing assertions failures. Turns out that event though test-runner is designed to automatically execute all test cases if you execute the program without any command line parameters, that wont work because the of limitations on changing the time resolution. Without significantly changing this restriction, test-runner cant be executed w/o command line parameters on either Linux or Windows. So my plan is the use the same approach to execute tests on Windows as on Linux, namely ./test.py. I need to do this anyway in order to pick up the Examples that get executed by ./test.py so the same set of tests and examples get executed on both Linux and Windows. Bottom line is that I don't ever see this behavior changing so i don't see the need for a Bugzilla issue. Yes, I don't think we wan to change the behavior of Simulator::Run. We *could* change Time::SetResolution not to dump the g_markingTimes list (but those tests which then Simulator::Run will still fail when run together. It looks like first.cc and sample-log-time-format.cc are the only ones which both SetResolution and Simulator::Run. We could hard-code an exclusive list in test-runner to run only one of those at a time. Seems a little hokey, but it would prevent this error. Which one should be enabled? Underlying issue is running each test suite in a separate process (Linux and Mac), vs. running all in the same process (Windows port). There didn't appear to be any good alternatives, other than run tests in Windows as in the other systems. Can we close this? I am OK to close as resolved/wontfix, and if the Windows VS port is revived someday in a similar fashion, it can be revisited then. Resolving as WONTFIX. Could also be considered as INVALID, since the Windows test framework was running all tests in a single process context, not as designed. |