diff options
7 files changed, 82 insertions, 433 deletions
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp index 38cdcd65..42f99471 100644 --- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp +++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp | |||
@@ -50,85 +50,6 @@ using ::android::sp; | |||
50 | #include <media_hidl_test_common.h> | 50 | #include <media_hidl_test_common.h> |
51 | #include <fstream> | 51 | #include <fstream> |
52 | 52 | ||
53 | // A class for test environment setup | ||
54 | class ComponentTestEnvironment : public ::testing::Environment { | ||
55 | public: | ||
56 | virtual void SetUp() {} | ||
57 | virtual void TearDown() {} | ||
58 | |||
59 | ComponentTestEnvironment() : instance("default"), res("/sdcard/media/") {} | ||
60 | |||
61 | void setInstance(const char* _instance) { instance = _instance; } | ||
62 | |||
63 | void setComponent(const char* _component) { component = _component; } | ||
64 | |||
65 | void setRole(const char* _role) { role = _role; } | ||
66 | |||
67 | void setRes(const char* _res) { res = _res; } | ||
68 | |||
69 | const hidl_string getInstance() const { return instance; } | ||
70 | |||
71 | const hidl_string getComponent() const { return component; } | ||
72 | |||
73 | const hidl_string getRole() const { return role; } | ||
74 | |||
75 | const hidl_string getRes() const { return res; } | ||
76 | |||
77 | int initFromOptions(int argc, char** argv) { | ||
78 | static struct option options[] = { | ||
79 | {"instance", required_argument, 0, 'I'}, | ||
80 | {"component", required_argument, 0, 'C'}, | ||
81 | {"role", required_argument, 0, 'R'}, | ||
82 | {"res", required_argument, 0, 'P'}, | ||
83 | {0, 0, 0, 0}}; | ||
84 | |||
85 | while (true) { | ||
86 | int index = 0; | ||
87 | int c = getopt_long(argc, argv, "I:C:R:P:", options, &index); | ||
88 | if (c == -1) { | ||
89 | break; | ||
90 | } | ||
91 | |||
92 | switch (c) { | ||
93 | case 'I': | ||
94 | setInstance(optarg); | ||
95 | break; | ||
96 | case 'C': | ||
97 | setComponent(optarg); | ||
98 | break; | ||
99 | case 'R': | ||
100 | setRole(optarg); | ||
101 | break; | ||
102 | case 'P': | ||
103 | setRes(optarg); | ||
104 | break; | ||
105 | case '?': | ||
106 | break; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | if (optind < argc) { | ||
111 | fprintf(stderr, | ||
112 | "unrecognized option: %s\n\n" | ||
113 | "usage: %s <gtest options> <test options>\n\n" | ||
114 | "test options are:\n\n" | ||
115 | "-I, --instance: HAL instance to test\n" | ||
116 | "-C, --component: OMX component to test\n" | ||
117 | "-R, --role: OMX component Role\n" | ||
118 | "-P, --res: Resource files directory location\n", | ||
119 | argv[optind ?: 1], argv[0]); | ||
120 | return 2; | ||
121 | } | ||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | private: | ||
126 | hidl_string instance; | ||
127 | hidl_string component; | ||
128 | hidl_string role; | ||
129 | hidl_string res; | ||
130 | }; | ||
131 | |||
132 | static ComponentTestEnvironment* gEnv = nullptr; | 53 | static ComponentTestEnvironment* gEnv = nullptr; |
133 | 54 | ||
134 | // audio decoder test fixture class | 55 | // audio decoder test fixture class |
@@ -1220,6 +1141,7 @@ int main(int argc, char** argv) { | |||
1220 | gEnv = new ComponentTestEnvironment(); | 1141 | gEnv = new ComponentTestEnvironment(); |
1221 | ::testing::AddGlobalTestEnvironment(gEnv); | 1142 | ::testing::AddGlobalTestEnvironment(gEnv); |
1222 | ::testing::InitGoogleTest(&argc, argv); | 1143 | ::testing::InitGoogleTest(&argc, argv); |
1144 | gEnv->init(&argc, argv); | ||
1223 | int status = gEnv->initFromOptions(argc, argv); | 1145 | int status = gEnv->initFromOptions(argc, argv); |
1224 | if (status == 0) { | 1146 | if (status == 0) { |
1225 | status = RUN_ALL_TESTS(); | 1147 | status = RUN_ALL_TESTS(); |
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp index 953dc750..d5f1f2da 100644 --- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp +++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp | |||
@@ -50,85 +50,6 @@ using ::android::sp; | |||
50 | #include <media_hidl_test_common.h> | 50 | #include <media_hidl_test_common.h> |
51 | #include <fstream> | 51 | #include <fstream> |
52 | 52 | ||
53 | // A class for test environment setup | ||
54 | class ComponentTestEnvironment : public ::testing::Environment { | ||
55 | public: | ||
56 | virtual void SetUp() {} | ||
57 | virtual void TearDown() {} | ||
58 | |||
59 | ComponentTestEnvironment() : instance("default"), res("/sdcard/media/") {} | ||
60 | |||
61 | void setInstance(const char* _instance) { instance = _instance; } | ||
62 | |||
63 | void setComponent(const char* _component) { component = _component; } | ||
64 | |||
65 | void setRole(const char* _role) { role = _role; } | ||
66 | |||
67 | void setRes(const char* _res) { res = _res; } | ||
68 | |||
69 | const hidl_string getInstance() const { return instance; } | ||
70 | |||
71 | const hidl_string getComponent() const { return component; } | ||
72 | |||
73 | const hidl_string getRole() const { return role; } | ||
74 | |||
75 | const hidl_string getRes() const { return res; } | ||
76 | |||
77 | int initFromOptions(int argc, char** argv) { | ||
78 | static struct option options[] = { | ||
79 | {"instance", required_argument, 0, 'I'}, | ||
80 | {"component", required_argument, 0, 'C'}, | ||
81 | {"role", required_argument, 0, 'R'}, | ||
82 | {"res", required_argument, 0, 'P'}, | ||
83 | {0, 0, 0, 0}}; | ||
84 | |||
85 | while (true) { | ||
86 | int index = 0; | ||
87 | int c = getopt_long(argc, argv, "I:C:R:P:", options, &index); | ||
88 | if (c == -1) { | ||
89 | break; | ||
90 | } | ||
91 | |||
92 | switch (c) { | ||
93 | case 'I': | ||
94 | setInstance(optarg); | ||
95 | break; | ||
96 | case 'C': | ||
97 | setComponent(optarg); | ||
98 | break; | ||
99 | case 'R': | ||
100 | setRole(optarg); | ||
101 | break; | ||
102 | case 'P': | ||
103 | setRes(optarg); | ||
104 | break; | ||
105 | case '?': | ||
106 | break; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | if (optind < argc) { | ||
111 | fprintf(stderr, | ||
112 | "unrecognized option: %s\n\n" | ||
113 | "usage: %s <gtest options> <test options>\n\n" | ||
114 | "test options are:\n\n" | ||
115 | "-I, --instance: HAL instance to test\n" | ||
116 | "-C, --component: OMX component to test\n" | ||
117 | "-R, --role: OMX component Role\n" | ||
118 | "-P, --res: Resource files directory location\n", | ||
119 | argv[optind ?: 1], argv[0]); | ||
120 | return 2; | ||
121 | } | ||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | private: | ||
126 | hidl_string instance; | ||
127 | hidl_string component; | ||
128 | hidl_string role; | ||
129 | hidl_string res; | ||
130 | }; | ||
131 | |||
132 | static ComponentTestEnvironment* gEnv = nullptr; | 53 | static ComponentTestEnvironment* gEnv = nullptr; |
133 | 54 | ||
134 | // audio encoder test fixture class | 55 | // audio encoder test fixture class |
@@ -562,6 +483,7 @@ int main(int argc, char** argv) { | |||
562 | gEnv = new ComponentTestEnvironment(); | 483 | gEnv = new ComponentTestEnvironment(); |
563 | ::testing::AddGlobalTestEnvironment(gEnv); | 484 | ::testing::AddGlobalTestEnvironment(gEnv); |
564 | ::testing::InitGoogleTest(&argc, argv); | 485 | ::testing::InitGoogleTest(&argc, argv); |
486 | gEnv->init(&argc, argv); | ||
565 | int status = gEnv->initFromOptions(argc, argv); | 487 | int status = gEnv->initFromOptions(argc, argv); |
566 | if (status == 0) { | 488 | if (status == 0) { |
567 | status = RUN_ALL_TESTS(); | 489 | status = RUN_ALL_TESTS(); |
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h index bec733dc..c1863d54 100644 --- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h +++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS | 21 | #define OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #include <getopt.h> | ||
24 | #include <media/stagefright/foundation/ALooper.h> | 25 | #include <media/stagefright/foundation/ALooper.h> |
25 | #include <utils/Condition.h> | 26 | #include <utils/Condition.h> |
26 | #include <utils/List.h> | 27 | #include <utils/List.h> |
@@ -33,6 +34,8 @@ | |||
33 | #include <media/openmax/OMX_AudioExt.h> | 34 | #include <media/openmax/OMX_AudioExt.h> |
34 | #include <media/openmax/OMX_VideoExt.h> | 35 | #include <media/openmax/OMX_VideoExt.h> |
35 | 36 | ||
37 | #include <VtsHalHidlTargetTestEnvBase.h> | ||
38 | |||
36 | /* TIME OUTS (Wait time in dequeueMessage()) */ | 39 | /* TIME OUTS (Wait time in dequeueMessage()) */ |
37 | 40 | ||
38 | /* As component is switching states (loaded<->idle<->execute), dequeueMessage() | 41 | /* As component is switching states (loaded<->idle<->execute), dequeueMessage() |
@@ -355,4 +358,77 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
355 | portreconfig fptr = nullptr, OMX_U32 kPortIndexInput = 0, | 358 | portreconfig fptr = nullptr, OMX_U32 kPortIndexInput = 0, |
356 | OMX_U32 kPortIndexOutput = 1, void* args = nullptr); | 359 | OMX_U32 kPortIndexOutput = 1, void* args = nullptr); |
357 | 360 | ||
361 | // A class for test environment setup | ||
362 | class ComponentTestEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { | ||
363 | private: | ||
364 | typedef ::testing::VtsHalHidlTargetTestEnvBase Super; | ||
365 | |||
366 | public: | ||
367 | virtual void registerTestServices() override { registerTestService<IOmx>(); } | ||
368 | |||
369 | ComponentTestEnvironment() : res("/sdcard/media/") {} | ||
370 | |||
371 | void setComponent(const char* _component) { component = _component; } | ||
372 | |||
373 | void setRole(const char* _role) { role = _role; } | ||
374 | |||
375 | void setRes(const char* _res) { res = _res; } | ||
376 | |||
377 | const hidl_string getInstance() { return Super::getServiceName<IOmx>(); } | ||
378 | |||
379 | const hidl_string getComponent() const { return component; } | ||
380 | |||
381 | const hidl_string getRole() const { return role; } | ||
382 | |||
383 | const hidl_string getRes() const { return res; } | ||
384 | |||
385 | int initFromOptions(int argc, char** argv) { | ||
386 | static struct option options[] = {{"component", required_argument, 0, 'C'}, | ||
387 | {"role", required_argument, 0, 'R'}, | ||
388 | {"res", required_argument, 0, 'P'}, | ||
389 | {0, 0, 0, 0}}; | ||
390 | |||
391 | while (true) { | ||
392 | int index = 0; | ||
393 | int c = getopt_long(argc, argv, "C:R:P:", options, &index); | ||
394 | if (c == -1) { | ||
395 | break; | ||
396 | } | ||
397 | |||
398 | switch (c) { | ||
399 | case 'C': | ||
400 | setComponent(optarg); | ||
401 | break; | ||
402 | case 'R': | ||
403 | setRole(optarg); | ||
404 | break; | ||
405 | case 'P': | ||
406 | setRes(optarg); | ||
407 | break; | ||
408 | case '?': | ||
409 | break; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | if (optind < argc) { | ||
414 | fprintf(stderr, | ||
415 | "unrecognized option: %s\n\n" | ||
416 | "usage: %s <gtest options> <test options>\n\n" | ||
417 | "test options are:\n\n" | ||
418 | "-C, --component: OMX component to test\n" | ||
419 | "-R, --role: OMX component Role\n" | ||
420 | "-P, --res: Resource files directory location\n", | ||
421 | argv[optind ?: 1], argv[0]); | ||
422 | return 2; | ||
423 | } | ||
424 | return 0; | ||
425 | } | ||
426 | |||
427 | private: | ||
428 | hidl_string instance; | ||
429 | hidl_string component; | ||
430 | hidl_string role; | ||
431 | hidl_string res; | ||
432 | }; | ||
433 | |||
358 | #endif // MEDIA_HIDL_TEST_COMMON_H | 434 | #endif // MEDIA_HIDL_TEST_COMMON_H |
diff --git a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp index d66136d2..f7c84336 100644 --- a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp +++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp | |||
@@ -48,75 +48,6 @@ using ::android::sp; | |||
48 | #include <getopt.h> | 48 | #include <getopt.h> |
49 | #include <media_hidl_test_common.h> | 49 | #include <media_hidl_test_common.h> |
50 | 50 | ||
51 | // A class for test environment setup | ||
52 | class ComponentTestEnvironment : public ::testing::Environment { | ||
53 | public: | ||
54 | virtual void SetUp() {} | ||
55 | virtual void TearDown() {} | ||
56 | |||
57 | ComponentTestEnvironment() : instance("default") {} | ||
58 | |||
59 | void setInstance(const char* _instance) { instance = _instance; } | ||
60 | |||
61 | void setComponent(const char* _component) { component = _component; } | ||
62 | |||
63 | void setRole(const char* _role) { role = _role; } | ||
64 | |||
65 | const hidl_string getInstance() const { return instance; } | ||
66 | |||
67 | const hidl_string getComponent() const { return component; } | ||
68 | |||
69 | const hidl_string getRole() const { return role; } | ||
70 | |||
71 | int initFromOptions(int argc, char** argv) { | ||
72 | static struct option options[] = { | ||
73 | {"instance", required_argument, 0, 'I'}, | ||
74 | {"component", required_argument, 0, 'C'}, | ||
75 | {"role", required_argument, 0, 'R'}, | ||
76 | {0, 0, 0, 0}}; | ||
77 | |||
78 | while (true) { | ||
79 | int index = 0; | ||
80 | int c = getopt_long(argc, argv, "I:C:R:", options, &index); | ||
81 | if (c == -1) { | ||
82 | break; | ||
83 | } | ||
84 | |||
85 | switch (c) { | ||
86 | case 'I': | ||
87 | setInstance(optarg); | ||
88 | break; | ||
89 | case 'C': | ||
90 | setComponent(optarg); | ||
91 | break; | ||
92 | case 'R': | ||
93 | setRole(optarg); | ||
94 | break; | ||
95 | case '?': | ||
96 | break; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | if (optind < argc) { | ||
101 | fprintf(stderr, | ||
102 | "unrecognized option: %s\n\n" | ||
103 | "usage: %s <gtest options> <test options>\n\n" | ||
104 | "test options are:\n\n" | ||
105 | "-I, --instance: HAL instance to test\n" | ||
106 | "-C, --component: OMX component to test\n" | ||
107 | "-R, --Role: OMX component Role\n", | ||
108 | argv[optind ?: 1], argv[0]); | ||
109 | return 2; | ||
110 | } | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | private: | ||
115 | hidl_string instance; | ||
116 | hidl_string component; | ||
117 | hidl_string role; | ||
118 | }; | ||
119 | |||
120 | static ComponentTestEnvironment* gEnv = nullptr; | 51 | static ComponentTestEnvironment* gEnv = nullptr; |
121 | 52 | ||
122 | // generic component test fixture class | 53 | // generic component test fixture class |
@@ -1321,6 +1252,7 @@ int main(int argc, char** argv) { | |||
1321 | gEnv = new ComponentTestEnvironment(); | 1252 | gEnv = new ComponentTestEnvironment(); |
1322 | ::testing::AddGlobalTestEnvironment(gEnv); | 1253 | ::testing::AddGlobalTestEnvironment(gEnv); |
1323 | ::testing::InitGoogleTest(&argc, argv); | 1254 | ::testing::InitGoogleTest(&argc, argv); |
1255 | gEnv->init(&argc, argv); | ||
1324 | int status = gEnv->initFromOptions(argc, argv); | 1256 | int status = gEnv->initFromOptions(argc, argv); |
1325 | if (status == 0) { | 1257 | if (status == 0) { |
1326 | status = RUN_ALL_TESTS(); | 1258 | status = RUN_ALL_TESTS(); |
diff --git a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp index 5a31d691..64abe1c1 100644 --- a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp +++ b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp | |||
@@ -50,54 +50,6 @@ using ::android::sp; | |||
50 | #include <getopt.h> | 50 | #include <getopt.h> |
51 | #include <media_hidl_test_common.h> | 51 | #include <media_hidl_test_common.h> |
52 | 52 | ||
53 | // A class for test environment setup | ||
54 | class ComponentTestEnvironment : public ::testing::Environment { | ||
55 | public: | ||
56 | virtual void SetUp() {} | ||
57 | virtual void TearDown() {} | ||
58 | |||
59 | ComponentTestEnvironment() : instance("default") {} | ||
60 | |||
61 | void setInstance(const char* _instance) { instance = _instance; } | ||
62 | |||
63 | const hidl_string getInstance() const { return instance; } | ||
64 | |||
65 | int initFromOptions(int argc, char** argv) { | ||
66 | static struct option options[] = { | ||
67 | {"instance", required_argument, 0, 'I'}, {0, 0, 0, 0}}; | ||
68 | |||
69 | while (true) { | ||
70 | int index = 0; | ||
71 | int c = getopt_long(argc, argv, "I:", options, &index); | ||
72 | if (c == -1) { | ||
73 | break; | ||
74 | } | ||
75 | |||
76 | switch (c) { | ||
77 | case 'I': | ||
78 | setInstance(optarg); | ||
79 | break; | ||
80 | case '?': | ||
81 | break; | ||
82 | } | ||
83 | } | ||
84 | |||
85 | if (optind < argc) { | ||
86 | fprintf(stderr, | ||
87 | "unrecognized option: %s\n\n" | ||
88 | "usage: %s <gtest options> <test options>\n\n" | ||
89 | "test options are:\n\n" | ||
90 | "-I, --instance: HAL instance to test\n", | ||
91 | argv[optind ?: 1], argv[0]); | ||
92 | return 2; | ||
93 | } | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | private: | ||
98 | hidl_string instance; | ||
99 | }; | ||
100 | |||
101 | static ComponentTestEnvironment* gEnv = nullptr; | 53 | static ComponentTestEnvironment* gEnv = nullptr; |
102 | 54 | ||
103 | class MasterHidlTest : public ::testing::VtsHalHidlTargetTestBase { | 55 | class MasterHidlTest : public ::testing::VtsHalHidlTargetTestBase { |
@@ -226,6 +178,7 @@ int main(int argc, char** argv) { | |||
226 | gEnv = new ComponentTestEnvironment(); | 178 | gEnv = new ComponentTestEnvironment(); |
227 | ::testing::AddGlobalTestEnvironment(gEnv); | 179 | ::testing::AddGlobalTestEnvironment(gEnv); |
228 | ::testing::InitGoogleTest(&argc, argv); | 180 | ::testing::InitGoogleTest(&argc, argv); |
181 | gEnv->init(&argc, argv); | ||
229 | int status = gEnv->initFromOptions(argc, argv); | 182 | int status = gEnv->initFromOptions(argc, argv); |
230 | if (status == 0) { | 183 | if (status == 0) { |
231 | status = RUN_ALL_TESTS(); | 184 | status = RUN_ALL_TESTS(); |
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp index 034992ec..40e76c9a 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp | |||
@@ -51,85 +51,6 @@ using ::android::sp; | |||
51 | #include <media_video_hidl_test_common.h> | 51 | #include <media_video_hidl_test_common.h> |
52 | #include <fstream> | 52 | #include <fstream> |
53 | 53 | ||
54 | // A class for test environment setup | ||
55 | class ComponentTestEnvironment : public ::testing::Environment { | ||
56 | public: | ||
57 | virtual void SetUp() {} | ||
58 | virtual void TearDown() {} | ||
59 | |||
60 | ComponentTestEnvironment() : instance("default"), res("/sdcard/media/") {} | ||
61 | |||
62 | void setInstance(const char* _instance) { instance = _instance; } | ||
63 | |||
64 | void setComponent(const char* _component) { component = _component; } | ||
65 | |||
66 | void setRole(const char* _role) { role = _role; } | ||
67 | |||
68 | void setRes(const char* _res) { res = _res; } | ||
69 | |||
70 | const hidl_string getInstance() const { return instance; } | ||
71 | |||
72 | const hidl_string getComponent() const { return component; } | ||
73 | |||
74 | const hidl_string getRole() const { return role; } | ||
75 | |||
76 | const hidl_string getRes() const { return res; } | ||
77 | |||
78 | int initFromOptions(int argc, char** argv) { | ||
79 | static struct option options[] = { | ||
80 | {"instance", required_argument, 0, 'I'}, | ||
81 | {"component", required_argument, 0, 'C'}, | ||
82 | {"role", required_argument, 0, 'R'}, | ||
83 | {"res", required_argument, 0, 'P'}, | ||
84 | {0, 0, 0, 0}}; | ||
85 | |||
86 | while (true) { | ||
87 | int index = 0; | ||
88 | int c = getopt_long(argc, argv, "I:C:R:P:", options, &index); | ||
89 | if (c == -1) { | ||
90 | break; | ||
91 | } | ||
92 | |||
93 | switch (c) { | ||
94 | case 'I': | ||
95 | setInstance(optarg); | ||
96 | break; | ||
97 | case 'C': | ||
98 | setComponent(optarg); | ||
99 | break; | ||
100 | case 'R': | ||
101 | setRole(optarg); | ||
102 | break; | ||
103 | case 'P': | ||
104 | setRes(optarg); | ||
105 | break; | ||
106 | case '?': | ||
107 | break; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | if (optind < argc) { | ||
112 | fprintf(stderr, | ||
113 | "unrecognized option: %s\n\n" | ||
114 | "usage: %s <gtest options> <test options>\n\n" | ||
115 | "test options are:\n\n" | ||
116 | "-I, --instance: HAL instance to test\n" | ||
117 | "-C, --component: OMX component to test\n" | ||
118 | "-R, --role: OMX component Role\n" | ||
119 | "-P, --res: Resource files directory location\n", | ||
120 | argv[optind ?: 1], argv[0]); | ||
121 | return 2; | ||
122 | } | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | private: | ||
127 | hidl_string instance; | ||
128 | hidl_string component; | ||
129 | hidl_string role; | ||
130 | hidl_string res; | ||
131 | }; | ||
132 | |||
133 | static ComponentTestEnvironment* gEnv = nullptr; | 54 | static ComponentTestEnvironment* gEnv = nullptr; |
134 | 55 | ||
135 | // video decoder test fixture class | 56 | // video decoder test fixture class |
@@ -1488,6 +1409,7 @@ int main(int argc, char** argv) { | |||
1488 | gEnv = new ComponentTestEnvironment(); | 1409 | gEnv = new ComponentTestEnvironment(); |
1489 | ::testing::AddGlobalTestEnvironment(gEnv); | 1410 | ::testing::AddGlobalTestEnvironment(gEnv); |
1490 | ::testing::InitGoogleTest(&argc, argv); | 1411 | ::testing::InitGoogleTest(&argc, argv); |
1412 | gEnv->init(&argc, argv); | ||
1491 | int status = gEnv->initFromOptions(argc, argv); | 1413 | int status = gEnv->initFromOptions(argc, argv); |
1492 | if (status == 0) { | 1414 | if (status == 0) { |
1493 | status = RUN_ALL_TESTS(); | 1415 | status = RUN_ALL_TESTS(); |
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp index 099658f8..2056d9e6 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp | |||
@@ -64,85 +64,6 @@ using ::android::sp; | |||
64 | #include <system/window.h> | 64 | #include <system/window.h> |
65 | #include <fstream> | 65 | #include <fstream> |
66 | 66 | ||
67 | // A class for test environment setup | ||
68 | class ComponentTestEnvironment : public ::testing::Environment { | ||
69 | public: | ||
70 | virtual void SetUp() {} | ||
71 | virtual void TearDown() {} | ||
72 | |||
73 | ComponentTestEnvironment() : instance("default"), res("/sdcard/media/") {} | ||
74 | |||
75 | void setInstance(const char* _instance) { instance = _instance; } | ||
76 | |||
77 | void setComponent(const char* _component) { component = _component; } | ||
78 | |||
79 | void setRole(const char* _role) { role = _role; } | ||
80 | |||
81 | void setRes(const char* _res) { res = _res; } | ||
82 | |||
83 | const hidl_string getInstance() const { return instance; } | ||
84 | |||
85 | const hidl_string getComponent() const { return component; } | ||
86 | |||
87 | const hidl_string getRole() const { return role; } | ||
88 | |||
89 | const hidl_string getRes() const { return res; } | ||
90 | |||
91 | int initFromOptions(int argc, char** argv) { | ||
92 | static struct option options[] = { | ||
93 | {"instance", required_argument, 0, 'I'}, | ||
94 | {"component", required_argument, 0, 'C'}, | ||
95 | {"role", required_argument, 0, 'R'}, | ||
96 | {"res", required_argument, 0, 'P'}, | ||
97 | {0, 0, 0, 0}}; | ||
98 | |||
99 | while (true) { | ||
100 | int index = 0; | ||
101 | int c = getopt_long(argc, argv, "I:C:R:P:", options, &index); | ||
102 | if (c == -1) { | ||
103 | break; | ||
104 | } | ||
105 | |||
106 | switch (c) { | ||
107 | case 'I': | ||
108 | setInstance(optarg); | ||
109 | break; | ||
110 | case 'C': | ||
111 | setComponent(optarg); | ||
112 | break; | ||
113 | case 'R': | ||
114 | setRole(optarg); | ||
115 | break; | ||
116 | case 'P': | ||
117 | setRes(optarg); | ||
118 | break; | ||
119 | case '?': | ||
120 | break; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | if (optind < argc) { | ||
125 | fprintf(stderr, | ||
126 | "unrecognized option: %s\n\n" | ||
127 | "usage: %s <gtest options> <test options>\n\n" | ||
128 | "test options are:\n\n" | ||
129 | "-I, --instance: HAL instance to test\n" | ||
130 | "-C, --component: OMX component to test\n" | ||
131 | "-R, --role: OMX component Role\n" | ||
132 | "-P, --res: Resource files directory location\n", | ||
133 | argv[optind ?: 1], argv[0]); | ||
134 | return 2; | ||
135 | } | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | private: | ||
140 | hidl_string instance; | ||
141 | hidl_string component; | ||
142 | hidl_string role; | ||
143 | hidl_string res; | ||
144 | }; | ||
145 | |||
146 | static ComponentTestEnvironment* gEnv = nullptr; | 67 | static ComponentTestEnvironment* gEnv = nullptr; |
147 | 68 | ||
148 | // video encoder test fixture class | 69 | // video encoder test fixture class |
@@ -1580,6 +1501,7 @@ int main(int argc, char** argv) { | |||
1580 | gEnv = new ComponentTestEnvironment(); | 1501 | gEnv = new ComponentTestEnvironment(); |
1581 | ::testing::AddGlobalTestEnvironment(gEnv); | 1502 | ::testing::AddGlobalTestEnvironment(gEnv); |
1582 | ::testing::InitGoogleTest(&argc, argv); | 1503 | ::testing::InitGoogleTest(&argc, argv); |
1504 | gEnv->init(&argc, argv); | ||
1583 | int status = gEnv->initFromOptions(argc, argv); | 1505 | int status = gEnv->initFromOptions(argc, argv); |
1584 | if (status == 0) { | 1506 | if (status == 0) { |
1585 | status = RUN_ALL_TESTS(); | 1507 | status = RUN_ALL_TESTS(); |