1 /*
2 * Copyright 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18 #include <cstdio>
19 #include "gtest/gtest.h"
20 #include <getopt.h>
21
22 static bool isGameCoreCertified = false;
23 static bool doFeatureCheck = true;
24
shouldSkipTest()25 bool shouldSkipTest() {
26 return doFeatureCheck && !isGameCoreCertified;
27 }
28
29 static const int OPTION_CERTIFIED = 0;
30 static const int OPTION_FEATURE_CHECK = 1;
31
main(int argc,char ** argv)32 int main(int argc, char **argv) {
33 printf("Running main() from %s\n", __FILE__);
34 testing::InitGoogleTest(&argc, argv);
35
36 static struct option long_options[] = {
37 { "gamecore-certified", required_argument, 0, 0 }, // default to false
38 { "gamecore-feature-check", required_argument, 0, 1 }, // default to true
39 { 0, 0, 0, 0 }
40 };
41 while(true) {
42 int c = getopt_long(argc, argv, "", long_options, nullptr);
43 if (c == -1) {
44 break;
45 }
46 switch (c) {
47 case OPTION_CERTIFIED:
48 std::istringstream(optarg) >> std::boolalpha >> isGameCoreCertified;
49 break;
50 case OPTION_FEATURE_CHECK:
51 std::istringstream(optarg) >> std::boolalpha >> doFeatureCheck;
52 break;
53 default:
54 break;
55 }
56 }
57
58 return RUN_ALL_TESTS();
59 }
60