-
Notifications
You must be signed in to change notification settings - Fork 237
refactor: remove getTestName from IRTests.java so tests do not rely on method name #1485
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
Conversation
Test Results 827 files ± 0 827 suites ±0 4h 20m 54s ⏱️ - 21m 45s Results for commit e04fcf9. ± Comparison against base commit 4722084. This pull request removes 59 and adds 160 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
@msridhar @juliandolby Hey whenever you get a chance could I get review on this, thank you! |
@jkhaliqi I love it! Do you have time to take this further? This is the key function that pulls out the name of the currently-running test: WALA/cast/java/src/testFixtures/java/com/ibm/wala/cast/java/test/IRTests.java Lines 357 to 366 in 90350c7
I'd love it if we could push this cleanup further so that the function above could just be deleted and everywhere we rely on it we instead use parameterized tests. I think it would involve a few more changes similar to what you've already done and (hopefully!) deleting a bunch of code. What do you think? |
Hey sounds good, and thank you! I'll give that a try and see how far I get |
cast/java/ecj/src/test/java/com/ibm/wala/cast/java/test/ECJJava15IRTest.java
Outdated
Show resolved
Hide resolved
d1483aa
to
ffbd13b
Compare
@jkhaliqi is this ready for review? |
@msridhar Yup, I believe this is ready for review, whenever you get a chance, thank you! |
ffbd13b
to
2eb871e
Compare
I just changed the JavaIRTests to be alphabetical as well for parametrized tests, but all should be good now! |
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.
Looking great! A couple of comments particularly on JavaIRTests
true, | ||
null); | ||
} | ||
static List<? extends IRAssertion> caForInterfaceTest1 = |
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.
This naming scheme caForXXX
is confusing. What does ca
mean? Can we use something more descriptive?
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.
I wasn't exactly sure what ca
also meant I got this variable name from the fourth parameter inside of runTests
. But i'm assuming it has something to do with the callGraph
and just changed it to be callAssertionsForXXX
. Let me know if theres a better name.
} | ||
|
||
@Test | ||
public void testArrayLiteral2() throws IllegalArgumentException, CancelException, IOException { | ||
public void testTwoClasses() throws IllegalArgumentException, CancelException, IOException { |
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.
Why are the remaining tests still here and not just run via the parameterized tests?
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.
Some of the remaining tests call runTests and store its output in a variable and then do other stuff with it so I just left those alone.
2eb871e
to
853fdb6
Compare
853fdb6
to
520e80e
Compare
@jkhaliqi can you just add commits to your branch from now on instead of force pushing? That will make it easier to see what is changing. I will squash the commits before merging. |
@msridhar Sounds good, sorry about that! |
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.
Thanks again so much for this cleanup! One more comment / question
runTest( | ||
singleTestSrc("InnerClassA"), | ||
rtJar, | ||
simpleTestEntryPoint("InnerClassA"), | ||
new ArrayList<>(), | ||
true, | ||
null); |
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.
There are many call sites now where we pass exactly these arguments, except that the test name is different. Could we possibly add a new wrapper method for runTest
that takes a single String
argument and then calls runTest
appropriately, and then replace all these other calls with a call to the wrapper method?
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.
Added in the wrapper, thank you!
0927112
to
e91d747
Compare
Thanks again for the contribution! |
@liblit I think you will need to approve again before this can land |
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.
According to this bot comment, this change results in a net increase of 101 tests. Is that expected?
Head branch was pushed to by a user without write access
@liblit I believe so, is there a way I can double check all the test cases the bot only shows a couple before showing the ... |
Yeah, this is pretty hard to check based on the bot comment which cuts off the output. Any ideas @liblit? I can see various artifacts related to the executed tests at the bottom of the page for the action run but not clear how to get the full differences from that. |
You could run the tests on your local machine. Test before and after your proposed changes. Presumably each of those will create some kind of artifact you can compare without truncation. |
Sure, I guess I was wondering if there's an easy way to run whatever code generates the comments on the pull requests, though I guess one could just run |
In 0db3fc9 I tried bumping up the limit on how many test changes are listed in the comment, using the |
@liblit Can you explain more on the test and artifact comparison I wasn't able to follow or find the artifacts created after running the test. But I did just run and compare and everything is the same as far as these tests with first number being current change and second one before changes. There's only an increase in one for the tests because the @parameterized part will run but everything else ran the same... |
Thanks again for the contribution @jkhaliqi! |
…n method name (wala#1485) Cleaned up `ECJJava15IRTest.java` by refactoring the tests to be parameterized to not rely on method name for running the tests. Also removed the `getTestName` from `IRTests` so the tests do not rely on that method to get the name of the test it should run. With this we pass in the name and tests can now be parameterized as well instead of relying on naming tests differently --------- Co-authored-by: Manu Sridharan <msridhar@gmail.com>
Cleaned up
ECJJava15IRTest.java
by refactoring the tests to be parameterized to not rely on method name for running the tests. Also removed thegetTestName
fromIRTests
so the tests do not rely on that method to get the name of the test it should run. With this we pass in the name and tests can now be parameterized as well instead of relying on naming tests differently