Skip to content

Commit

Permalink
Fix CustomAutogradTest.ReentrantPriority rerun failures (#49581)
Browse files Browse the repository at this point in the history
Summary:
Clear static variable at the end of the test to ensure test passes after re-runs

Pull Request resolved: #49581

Test Plan:
`./bin/test_api "--gtest_filter=CustomAutogradTest.ReentrantPriority" --gtest_repeat=50`
Before the change all subsequent runs of the test failed with
```
../test/cpp/api/autograd.cpp:681: Failure
Expected equality of these values:
  order.size()
    Which is: 310
  10
```

Reviewed By: mrshenli

Differential Revision: D25632374

Pulled By: malfet

fbshipit-source-id: 4814d22b5dff15e1b38a0187e51070771fd58370
  • Loading branch information
malfet authored and facebook-github-bot committed Dec 18, 2020
1 parent 43f6da7 commit 020c443
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/cpp/api/autograd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,8 @@ TEST(CustomAutogradTest, ReentrantPriority) {
ASSERT_EQ(order.size(), 10);
ASSERT_EQ(std::count(order.begin(), order.end(), 1), 9);
ASSERT_EQ(order.back(), 0);
// Clear static variable in case test get executed in a loop
order.clear();
}

TEST(CustomAutogradTest, Hooks) {
Expand Down

0 comments on commit 020c443

Please sign in to comment.