• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2019 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 
6 // system_utils_unittest_helper.cpp: Helper to the SystemUtils.RunApp unittest
7 
8 #include "test_utils_unittest_helper.h"
9 
10 #include "../src/tests/test_utils/runner/TestSuite.h"
11 #include "common/system_utils.h"
12 
13 #include <string.h>
14 
main(int argc,char ** argv)15 int main(int argc, char **argv)
16 {
17     for (int argIndex = 1; argIndex < argc; ++argIndex)
18     {
19         if (strcmp(argv[argIndex], kRunTestSuite) == 0)
20         {
21             angle::TestSuite testSuite(&argc, argv);
22             return testSuite.run();
23         }
24     }
25 
26     if (argc != 3 || strcmp(argv[1], kRunAppTestArg1) != 0 || strcmp(argv[2], kRunAppTestArg2) != 0)
27     {
28         fprintf(stderr, "Expected command line:\n%s %s %s\n", argv[0], kRunAppTestArg1,
29                 kRunAppTestArg2);
30         return EXIT_FAILURE;
31     }
32 
33     std::string env = angle::GetEnvironmentVar(kRunAppTestEnvVarName);
34     if (env == "")
35     {
36         printf("%s", kRunAppTestStdout);
37         fprintf(stderr, "%s", kRunAppTestStderr);
38     }
39     else
40     {
41         fprintf(stderr, "%s", env.c_str());
42     }
43 
44     return EXIT_SUCCESS;
45 }
46