1 // Copyright 2019 The Bazel Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include <stdio.h>
16 #include <string.h>
17
main(int argc,char ** argv)18 int main(int argc, char** argv) {
19 static const char* kExpected[] = {
20 "a b",
21 "c d",
22 "tests/native_binary/testdata.txt",
23 "$(location",
24 "testdata.txt)",
25 "tests/native_binary/testdata.txt",
26 "tests/native_binary/testdata.txt $(location testdata.txt) tests/native_binary/testdata.txt",
27 "$TEST_SRCDIR",
28 "${TEST_SRCDIR}",
29 "",
30 };
31
32 for (int i = 1; i < argc; ++i) {
33 if (!kExpected[i - 1][0]) {
34 fprintf(stderr, "too many arguments, expected only %d\n", i);
35 return 1;
36 }
37 if (argc < i) {
38 fprintf(stderr, "expected more than %d arguments\n", i);
39 return 1;
40 }
41 if (strcmp(argv[i], kExpected[i - 1]) != 0) {
42 fprintf(stderr, "argv[%d]=(%s), expected (%s)\n", i, argv[i],
43 kExpected[i - 1]);
44 return 1;
45 }
46 }
47 return 0;
48 }
49