Avoid flakiness by skipping more output verification.
- Add a SCOPED_TRACE in case it flakes out again. - The test doesn't need to be very long, so shorten it to save the bots some time. TBR=henrike@webrtc.org BUG= TEST=voe_auto_test Review URL: https://webrtc-codereview.appspot.com/588006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2273 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
6ed617be22
commit
a1a34d675f
@ -21,7 +21,8 @@ namespace {
|
|||||||
const int16_t kLimiterHeadroom = 29204; // == -1 dbFS
|
const int16_t kLimiterHeadroom = 29204; // == -1 dbFS
|
||||||
const int16_t kInt16Max = 0x7fff;
|
const int16_t kInt16Max = 0x7fff;
|
||||||
const int kSampleRateHz = 16000;
|
const int kSampleRateHz = 16000;
|
||||||
const int kTestDurationMs = 4000;
|
const int kTestDurationMs = 3000;
|
||||||
|
const int kSkipOutputMs = 500;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@ -102,18 +103,21 @@ class MixingTest : public AfterInitializationFixture {
|
|||||||
FILE* output_file = fopen(output_filename_.c_str(), "rb");
|
FILE* output_file = fopen(output_filename_.c_str(), "rb");
|
||||||
ASSERT_TRUE(output_file != NULL);
|
ASSERT_TRUE(output_file != NULL);
|
||||||
int16_t output_value = 0;
|
int16_t output_value = 0;
|
||||||
// Skip the first 100 ms to avoid initialization and ramping-in effects.
|
// Skip the first segment to avoid initialization and ramping-in effects.
|
||||||
EXPECT_EQ(0, fseek(output_file, sizeof(output_value) * kSampleRateHz / 10,
|
EXPECT_EQ(0, fseek(output_file, sizeof(output_value) *
|
||||||
SEEK_SET));
|
kSampleRateHz / 1000 * kSkipOutputMs, SEEK_SET));
|
||||||
int samples_read = 0;
|
int samples_read = 0;
|
||||||
while (fread(&output_value, sizeof(output_value), 1, output_file) == 1) {
|
while (fread(&output_value, sizeof(output_value), 1, output_file) == 1) {
|
||||||
samples_read++;
|
samples_read++;
|
||||||
|
std::ostringstream trace_stream;
|
||||||
|
trace_stream << samples_read << " samples read";
|
||||||
|
SCOPED_TRACE(trace_stream.str());
|
||||||
EXPECT_LE(output_value, max_output_value);
|
EXPECT_LE(output_value, max_output_value);
|
||||||
EXPECT_GE(output_value, min_output_value);
|
EXPECT_GE(output_value, min_output_value);
|
||||||
}
|
}
|
||||||
// Ensure the recording length is close to the duration of the test.
|
// Ensure the recording length is close to the duration of the test.
|
||||||
ASSERT_GE((samples_read * 1000.0f) / kSampleRateHz,
|
ASSERT_GE((samples_read * 1000.0f) / kSampleRateHz,
|
||||||
0.9f * kTestDurationMs);
|
kTestDurationMs - kSkipOutputMs);
|
||||||
// Ensure we read the entire file.
|
// Ensure we read the entire file.
|
||||||
ASSERT_NE(0, feof(output_file));
|
ASSERT_NE(0, feof(output_file));
|
||||||
ASSERT_EQ(0, fclose(output_file));
|
ASSERT_EQ(0, fclose(output_file));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user