New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add command line option to Run ignore test #908
Conversation
@@ -45,6 +45,7 @@ class CommandLineArguments | |||
bool isColor() const; | |||
bool isListingTestGroupNames() const; | |||
bool isListingTestGroupAndCaseNames() const; | |||
bool isRunIgnore() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, whats with the spacing? :)
I'd suggest to make the option -i (or so) and make the longer option --ignore (with double-dash). That is kinda the practice in unix apps. Or just have the -i option. |
Hey @cuitoldfish you spooked the Dos build :D. One of its 6 part-exes ran out of memory linking. @basvodde Guess we'll just have to drop the tests, hehe ;-) |
7th part :) |
hey, only "-i" option can describe clearly? what's the failure? I have slow network and could not response to those failure immediately. what's does this "ran out of memory linking" mean? I didn't do any thing to consume the size. |
@cuitoldfish well you didnt. but your code did ;-). |
-ri will be fine. Not sure why the r ? |
@cuitoldfish yeah, unless you feel like fiddling with |
—ri is the abbreviation of run ignore, i think it is easier to remember |
Ah run :) Ok |
The rest looks good. But would appreciate fixing the formatting. If you look at the pull request diff, you can see it looks kinda ugly now :( |
Oh, I forget to mention that formatting error. That is because wrong configuration in my editor. I have corrected those. Will commit soon |
@@ -69,6 +70,7 @@ class CommandLineArguments | |||
bool runTestsAsSeperateProcess_; | |||
bool listTestGroupNames_; | |||
bool listTestGroupAndCaseNames_; | |||
bool runIgnore_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum hum :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I'm sorry for this missing one, thanks for your reminder!
Another simplification. I'm a bit annoyed by the "setRunIgnored" flag, but haven't figured out yet how to get rid of that. But at least, you can remove the _runIgnored member field out of the UtestShell and only have it in the IgnoredShell... Then you can also remove the isIgnored from the UtestShell interface. |
the current implementation in TestRegistry program to the UtestShell interface, if isRunIgnored only exist IgnoredShell, then how to call it from TestRegistry? |
:) It isn't called from TestRegistry as far as I can see :) |
@@ -50,6 +50,7 @@ void TestRegistry::runAllTests(TestResult& result) | |||
result.testsStarted(); | |||
for (UtestShell *test = tests_; test != NULL; test = test->getNext()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@basvodde , here we can see, in the TestRegistry, all test shell is taken to process one by one based on the UtestShell interface. so i need to add setRunIgnore in the UtestShell interface, or I have to segregate the UtestShell interface to get a few new classification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@basvodde it is in fact a new interface we are adding to UtestShell, and that's why in my opinion it needs to be there (like @cuitoldfish pointed out). It is the same as runInSeparateProcess_ or currentRepetition_. We need to be able to tell UtestShell from the "outside world" how it is supposed to behave, e.g. test->setRunIgnore()
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isRunIgnore is not called everywhere outside the class, so adding it is not useful. In fact, it shouldn't have been added if the code was test-driven....
Also the member varialble is never used and can be moved down in the class hierarchy. I recommend to do that as it isn't needed to have that state in the UtestShell.
I wish we could move the setRunIgnored also out of the UTestShell interface, but I wouldn't know how. The reason is that usually this kind of information is given at object construction time, but the UtestShell is constructed at program start, so that isn't possible. So, I guess we'll need to keep that one method in the UtestShell interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I agree.
UtestShell::isRunIgnore()
is not called outside the class, I will remove it.
For the setRunIgnored
and that member variable, I also think defined in UtestShell is not the best design, but due to current class hierarchy(UtestShell and IgnoreTestShell) and inter-class dependency(TestRegistry and UtestShell Interface), we can not get bettern place to hold the setRunIgnored
and the member variable, unless we do some refactorying on the class hierrachy, eg. segregate the UtestShell interface. But currently it's not deserved to refactorying the interface. We can do this as the interface beome fatter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make setRunIgnored virtual. Let the UtestShell implement return true and move the member variable in the subclass.
You do not need the member variable in the base class and removing that makes it simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I also plan to do that. and what's your thinking of interface segregate for UtestShell? maybe We need to do it in case UtestShell interface become fatter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't like the setIgnoreTest in the interface, but for now I think it is ok.
As I mentioned, usually this kind of info is passed on creation, but in our case we cannot do that because the creation happens in the macro. So, for now its ok.
I was just wondering what the output will be of an ignored test that is run. Currently, the output would be" .! # normal test followed by ignored test
TEST(group, test1) - 0ms # normal test with -v
IGNORE_TEST(group, test2) -0ms # ignored test with -v My expectation is that this, when ignored tests are run, changes to: .. # normal test followed by ignored test that is run
TEST(group, test1) - 0ms # normal test with -v
TEST(group, test2) - 0ms # ignored test that is run with -v Is this actually the case? Does everyone agree that this is how it should be? In my opinion, one should be able to tell from the output at a glance whether an ignored test was run or not. Also, statistics in the summary line should change accordingly, because the ignored tests which are run are no longer ignored. Ignored tests which are not run should stay as is. |
I see there is a test for the summary counts. But there isn't one for the output. |
i prefer .. # normal test followed by ignored test
TEST(group, test1) # normal test with -v
IGNORE_TEST(group, test2) # ignored test with -v because user know he is running the IGNORE_TEST, the output should tell this truth. The statistics has been changed accordingly, when IGNORE_TEST run, ignore count will not increase but the run count will increase |
@cuitoldfish hmmm. I think replacing ! by . but not replacing the -v output is inconsistent (if that's really what you meant) |
Another, rather small thing -- grammatically speaking, I would prefer runIgnoredSomething in the code to runIgnoreSomethin`. |
@basvodde There is no need to change input, as can be seen here: $ ./CppUTestTests.exe -v "IGNORE_TEST(UtestShell, IgnoreTestAccessingFixture)"
IGNORE_TEST(UtestShell, IgnoreTestAccessingFixture) - 0 ms
OK (613 tests, 0 ran, 0 checks, 1 ignored, 612 filtered out, 0 ms)
$ ./CppUTestTests.exe -v "TEST(UtestShell, IgnoreTestAccessingFixture)"
IGNORE_TEST(UtestShell, IgnoreTestAccessingFixture) - 0 ms
OK (613 tests, 0 ran, 0 checks, 1 ignored, 612 filtered out, 0 ms) Adding the -ri flag would run the test. No difference there. |
@arstrube if I have a ignore test IGNORE_TEST(group, test2) then if I run cpputest using this command your expectation is TEST(group, test2) - 0 ms
OK (613 tests, 1 ran, 0 checks, 0 ignored, 612 filtered out, 0 ms) seems strange incongruity :) |
Yeah, but this "feature" is not part of the requirements that we agreed on :P The requirements say that only if you do TEST(group, test2) - 0 ms
OK (613 tests, 1 ran, 0 checks, 0 ignored, 612 filtered out, 0 ms) |
It may not be what a user might expect, but it is consistent with how we said this thing should work :). I mean, if I specify the same test case by means of -sg / -sn, it isn't going to be run, either. |
Did you merge cpputest/master / rebase to cpputest/master? It's still spooking the Dos build ;-) |
Oh, it seems like a new problem this time. @basvodde if I recall correctly, TestUTestMacro is rather large also. It may need breaking up; or perhaps @cuitoldfish can reduce the size of his tests by 27 bytes :P.... |
@arstrube Ok, I'll look at splitting some other time. What I meant with the output is that is you change it to IGNORE_TEST_RUN_AWAY(gorup, name) then you also need to add that as possible input. |
@arstrube , I haven't rebase or merge master, I would like to finalize current implementation and then do that to pass the CI. But did you mention currently there is still issue in TestUTestMacro to hamper the CI? |
@cuitoldfish maybe better if you merge. If the Dos problem goes away, we're good. @basvodde If not, this won't pass before the UtestMacroTests are split in some way. |
@cuitoldfish why, you removed a method didn't you. But the code grew fatter and coverage went down :-) |
I removed IgnoredUtestShell::isRunIgnore() because it's not needed as discussed |
The decrease may because the virtual method void UtestShell::setRunIgnore(). This is just a interface, it's body will not be executed so that coverage decrease. |
You'll need to test it. So it doesn't do anything fishy :-P. Or at least enclose it in // LCOV_EXCL_START
// LCOV_EXCL_STOP Of course you had to remove IgnoredUtestShell::isRunIgnore(). I was just joking about removing a method and still the code size in Dos grew by some 1.8 kbytes :) And, may I point out that the class is IgnoredUtestShell and not IgnoreUtestShell ;-). So, personally, I'd like the method and variable names to be consistent with that. |
No problem about passing Dos later, but I'd say the 1.8k problem is different to the original one and only splitting up the UtestMacro tests will make it go away. Not necessarily the files, but the test groups. Because one test group has hit the 64k limit. |
I haven't notice the extra |
Excellent, thanks! |
@cuitoldfish nice :) |
Actually, I'm not entirely clear what the linker means complaining about |
I think at least from test design point of view, there should be separate test file for UtestShell and IgnoreTestShell, right? |
Sounds good to me. |
After looking at it more closely, there were some IgnoredUtestShell tests in there already that conceptionally belong to UtestTest.cpp. Along with your new tests, I will move them there. It is a rather small file. So we don't have to go to the trouble to split files at this point. |
using "-runIgnore" to run IGNORE_TEST