(args)
| 117 | return 0 |
| 118 | |
| 119 | def Main(args): |
| 120 | if (len(args) < MIN_ARGS or args[1] in ("-h", "--help", "help")): |
| 121 | print(__doc__) |
| 122 | return 1 |
| 123 | |
| 124 | outdir = sys.argv[1] |
| 125 | tempdir = sys.argv[2] |
| 126 | result = 0 |
| 127 | examples = EXAMPLES |
| 128 | compilers = (GCC, CLANG) |
| 129 | languages = (C, CXX) |
| 130 | if len(args) > MIN_ARGS: |
| 131 | custom_compilers = [] |
| 132 | custom_languages = [] |
| 133 | custom_examples = [] |
| 134 | for i in range(MIN_ARGS, len(args)): |
| 135 | arg = args[i] |
| 136 | if arg == "c" and C not in custom_languages: |
| 137 | custom_languages.append(C) |
| 138 | elif arg in ("cc", "cpp", "cxx", "c++") and CXX not in custom_languages: |
| 139 | custom_languages.append(CXX) |
| 140 | elif arg in ("gcc", "g++") and GCC not in custom_compilers: |
| 141 | custom_compilers.append(GCC) |
| 142 | elif arg in ("clang", "clang++") and CLANG not in custom_compilers: |
| 143 | custom_compilers.append(CLANG) |
| 144 | elif arg in EXAMPLES and arg not in custom_examples: |
| 145 | custom_examples.append(arg) |
| 146 | else: |
| 147 | print("Didn't understand '%s'" % arg) |
| 148 | return 1 |
| 149 | if custom_compilers: |
| 150 | compilers = custom_compilers |
| 151 | if custom_languages: |
| 152 | languages = custom_languages |
| 153 | if custom_examples: |
| 154 | examples = custom_examples |
| 155 | for example in examples: |
| 156 | runner = Runner(example, outdir, tempdir) |
| 157 | for compiler in compilers: |
| 158 | for language in languages: |
| 159 | c = runner.CompileAndRun(compiler, language) |
| 160 | if c: result = c |
| 161 | if result: |
| 162 | print("\nFinished with errors.") |
| 163 | else: |
| 164 | print("\nFinished successfully.") |
| 165 | return result |
| 166 | |
| 167 | if __name__ == "__main__": |
| 168 | sys.exit(Main(sys.argv)) |
no test coverage detected
searching dependent graphs…