OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #include "webrtc/voice_engine/test/auto_test/voe_standard_test.h" | |
12 | |
13 #include <assert.h> | |
14 #include <stdio.h> | |
15 #include <string.h> | |
16 | |
17 #include "webrtc/rtc_base/flags.h" | |
18 #include "webrtc/system_wrappers/include/event_wrapper.h" | |
19 #include "webrtc/typedefs.h" | |
20 #include "webrtc/voice_engine/test/auto_test/automated_mode.h" | |
21 #include "webrtc/voice_engine/test/auto_test/voe_test_defines.h" | |
22 #include "webrtc/voice_engine/voice_engine_defines.h" | |
23 | |
24 DEFINE_bool(include_timing_dependent_tests, true, | |
25 "If true, we will include tests / parts of tests that are known " | |
26 "to break in slow execution environments (such as valgrind)."); | |
27 DEFINE_bool(automated, false, | |
28 "If true, we'll run the automated tests we have in noninteractive " | |
29 "mode."); | |
30 DEFINE_bool(help, false, "Print this message."); | |
31 | |
32 namespace webrtc { | |
33 namespace voetest { | |
34 | |
35 int dummy = 0; // Dummy used in different functions to avoid warnings | |
36 | |
37 void SubAPIManager::DisplayStatus() const { | |
38 TEST_LOG("Supported sub APIs:\n\n"); | |
39 if (_base) | |
40 TEST_LOG(" Base\n"); | |
41 if (_codec) | |
42 TEST_LOG(" Codec\n"); | |
43 if (_file) | |
44 TEST_LOG(" File\n"); | |
45 if (_hardware) | |
46 TEST_LOG(" Hardware\n"); | |
47 if (_network) | |
48 TEST_LOG(" Network\n"); | |
49 if (_rtp_rtcp) | |
50 TEST_LOG(" RTP_RTCP\n"); | |
51 if (_apm) | |
52 TEST_LOG(" AudioProcessing\n"); | |
53 ANL(); | |
54 TEST_LOG("Excluded sub APIs:\n\n"); | |
55 if (!_base) | |
56 TEST_LOG(" Base\n"); | |
57 if (!_codec) | |
58 TEST_LOG(" Codec\n"); | |
59 if (!_file) | |
60 TEST_LOG(" File\n"); | |
61 if (!_hardware) | |
62 TEST_LOG(" Hardware\n"); | |
63 if (!_network) | |
64 TEST_LOG(" Network\n"); | |
65 if (!_rtp_rtcp) | |
66 TEST_LOG(" RTP_RTCP\n"); | |
67 if (!_apm) | |
68 TEST_LOG(" AudioProcessing\n"); | |
69 ANL(); | |
70 } | |
71 | |
72 int RunInManualMode() { | |
73 SubAPIManager api_manager; | |
74 api_manager.DisplayStatus(); | |
75 | |
76 printf("----------------------------\n"); | |
77 printf("Select type of test\n\n"); | |
78 printf(" (0) Quit\n"); | |
79 printf(" (1) Standard test\n"); | |
80 printf("\n: "); | |
81 | |
82 int selection(0); | |
83 dummy = scanf("%d", &selection); | |
84 | |
85 switch (selection) { | |
86 case 0: | |
87 return 0; | |
88 case 1: | |
89 TEST_LOG("\n\n+++ Running standard tests +++\n\n"); | |
90 // Currently, all googletest-rewritten tests are in the "automated" suite. | |
91 return RunInAutomatedMode(); | |
92 default: | |
93 TEST_LOG("Invalid selection!\n"); | |
94 return 0; | |
95 } | |
96 } | |
97 | |
98 } // namespace voetest | |
99 } // namespace webrtc | |
100 | |
101 #if !defined(WEBRTC_IOS) | |
102 int main(int argc, char** argv) { | |
103 // This function and RunInAutomatedMode is defined in automated_mode.cc | |
104 // to avoid macro clashes with googletest (for instance ASSERT_TRUE). | |
105 webrtc::voetest::InitializeGoogleTest(&argc, argv); | |
106 if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true)) { | |
107 return 1; | |
108 } | |
109 if (FLAG_help) { | |
110 rtc::FlagList::Print(nullptr, false); | |
111 return 0; | |
112 } | |
113 | |
114 if (FLAG_automated) { | |
115 return webrtc::voetest::RunInAutomatedMode(); | |
116 } | |
117 | |
118 return webrtc::voetest::RunInManualMode(); | |
119 } | |
120 #endif //#if !defined(WEBRTC_IOS) | |
OLD | NEW |