Deletion of temp files in modules_unittests.
Temporary files created by AudioFormat tests in modules_unittest are removed after each test case rather than after the whole suite is finished. This saves disk space on the running device. Bug: webrtc:8344 Change-Id: Iace3a7a62bb06e15fa596caf32da873944654c9a Reviewed-on: https://webrtc-review.googlesource.com/8100 Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20244}
This commit is contained in:

committed by
Commit Bot

parent
0c1c6e2d24
commit
8ffeeb2e34
@ -308,6 +308,19 @@ void ClearTempFiles() {
|
|||||||
remove(kv.second.c_str());
|
remove(kv.second.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only remove "out" files. Keep "ref" files.
|
||||||
|
void ClearTempOutFiles() {
|
||||||
|
for (auto it = temp_filenames.begin(); it != temp_filenames.end();) {
|
||||||
|
const std::string& filename = it->first;
|
||||||
|
if (filename.substr(0, 3).compare("out") == 0) {
|
||||||
|
remove(it->second.c_str());
|
||||||
|
temp_filenames.erase(it++);
|
||||||
|
} else {
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OpenFileAndReadMessage(const std::string& filename, MessageLite* msg) {
|
void OpenFileAndReadMessage(const std::string& filename, MessageLite* msg) {
|
||||||
FILE* file = fopen(filename.c_str(), "rb");
|
FILE* file = fopen(filename.c_str(), "rb");
|
||||||
ASSERT_TRUE(file != NULL);
|
ASSERT_TRUE(file != NULL);
|
||||||
@ -2422,6 +2435,11 @@ class AudioProcessingTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TearDown() {
|
||||||
|
// Remove "out" files after each test.
|
||||||
|
ClearTempOutFiles();
|
||||||
|
}
|
||||||
|
|
||||||
static void TearDownTestCase() {
|
static void TearDownTestCase() {
|
||||||
ClearTempFiles();
|
ClearTempFiles();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user