Repository navigation
[CI][C++] Remove useless test-file-cleanup step #51096
Copy link
Copy link
Closed
Description
Describe the enhancement requested
We have a test file cleanup in run-test.sh that calls find twice with the same parameters, computes the difference and tries to delete files only in the second result. But nothing happens between the two find calls: the results should always be the same (except if there's a race condition).
Since this code isn't doing anything useful, and it doesn't seem to cause any problem, we should just remove it.
arrow/cpp/build-support/run-test.sh
Lines 195 to 222 in e9ec94b
| if [ "$ATTEMPT_NUMBER" -lt "$TEST_EXECUTION_ATTEMPTS" ]; then | |
| # If the test fails, the test output may or may not be left behind, | |
| # depending on whether the test cleaned up or exited immediately. Either | |
| # way we need to clean it up. We do this by comparing the data directory | |
| # contents before and after the test runs, and deleting anything new. | |
| # | |
| # The comm program requires that its two inputs be sorted. | |
| TEST_TMPDIR_BEFORE=$(find "$TEST_TMPDIR" -maxdepth 1 -type d | sort) | |
| fi | |
| if [ "$ATTEMPT_NUMBER" -lt "$TEST_EXECUTION_ATTEMPTS" ]; then | |
| # Now delete any new test output. | |
| TEST_TMPDIR_AFTER=$(find "$TEST_TMPDIR" -maxdepth 1 -type d | sort) | |
| DIFF=$(comm -13 <(echo "$TEST_TMPDIR_BEFORE") \ | |
| <(echo "$TEST_TMPDIR_AFTER")) | |
| for DIR in $DIFF; do | |
| # Multiple tests may be running concurrently. To avoid deleting the | |
| # wrong directories, constrain to only directories beginning with the | |
| # test name. | |
| # | |
| # This may delete old test directories belonging to this test, but | |
| # that's not typically a concern when rerunning flaky tests. | |
| if [[ $DIR =~ ^$TEST_TMPDIR/$TEST_NAME ]]; then | |
| echo Deleting leftover flaky test directory "$DIR" | |
| rm -Rf "$DIR" | |
| fi | |
| done | |
| fi |
Component(s)
C++, Continuous Integration
Reactions are currently unavailable
Activity
pitrou commentedon Aug 31, 2026
@kou @hiroyuki-sato Opinions?
pitrou commentedon Aug 31, 2026
Also,
$TEST_TMPDIRdoesn't seem to be defined...Diveyam-Mishra commentedon Aug 31, 2026
Seems like a very straight up solution Would like to take this up as my first issue in this repo ?
pitrou commentedon Aug 31, 2026
@Diveyam-Mishra Definitely, but I would like to wait for @kou 's opinion before we do this.
kou commentedon Aug 31, 2026
Good catch. It seems that this was introduced by GH-29.
We can remove the retry feature entirely from this script because we can use the CTest's retry feature.
@Diveyam-Mishra Could you add "take" only comment here to assign this issue to you?
Diveyam-Mishra commentedon Aug 31, 2026
take
GH-51096: [CI][C++] Remove useless test-file-cleanup and retry logic …
kou commentedon Sep 1, 2026
Issue resolved by pull request 51110
#51110