|
432 | 432 | bazel build --extra_execution_platforms="${pkg}:my_platform" ${pkg}:a --execution_log_json_file out.txt || fail "Build failed"
|
433 | 433 | grep "platform_key" out.txt || fail "Did not find the platform key"
|
434 | 434 | grep "override_value" out.txt || fail "Did not find the overriding value"
|
435 |
| - grep "default_value" out.txt && fail "Used the default value" |
| 435 | + # If we could do json parsing, we would check that override_value is used for |
| 436 | + # the cc_test and default_value is used for all other targets. |
| 437 | + # Instead, just check that the number of grep matches is the same. |
| 438 | + assert_equals \ |
| 439 | + "$(grep -c override_valu
F1DA
e out.txt)" \ |
| 440 | + "$(grep -c "targetLabel.*${pkg}:a" out.txt)" \ |
| 441 | + "Used override_value the wrong number of times" |
| 442 | + # Note: `grep -c` should not fail if there are no matches. |
| 443 | + assert_equals \ |
| 444 | + "$(grep -c default_value out.txt || true)" \ |
| 445 | + "$(grep targetLabel out.txt | (grep -cv "${pkg}:a" || true))" \ |
| 446 | + "Used default_value the wrong number of times" |
436 | 447 |
|
437 | 448 | bazel test --extra_execution_platforms="${pkg}:my_platform" ${pkg}:a --execution_log_json_file out.txt || fail "Test failed"
|
438 | 449 | grep "platform_key" out.txt || fail "Did not find the platform key"
|
|
510 | 521 | bazel build --extra_execution_platforms="${pkg}:my_platform" ${pkg}:a --execution_log_json_file out.txt || fail "Build failed"
|
511 | 522 | grep "platform_key" out.txt || fail "Did not find the platform key"
|
512 | 523 | grep "override_value" out.txt || fail "Did not find the overriding value"
|
513 |
| - grep "default_value" out.txt && fail "Used the default value" |
| 524 | + # If we could do json parsing, we would check that override_value is used for |
| 525 | + # the cc_test and default_value is used for all other targets. |
| 526 | + # Instead, just check that the number of grep matches is the same. |
| 527 | + assert_equals \ |
| 528 | + "$(grep -c override_value out.txt)" \ |
| 529 | + "$(grep -c "targetLabel.*${pkg}:a" out.txt)" \ |
| 530 | + "Used override_value the wrong number of times" |
| 531 | + # Note: `grep -c` should not fail if there are no matches. |
| 532 | + assert_equals \ |
| 533 | + "$(grep -c default_value out.txt || true)" \ |
| 534 | + "$(grep targetLabel out.txt | (grep -cv "${pkg}:a" || true))" \ |
| 535 | + "Used default_value the wrong number of times" |
514 | 536 |
|
515 | 537 | bazel test --extra_execution_platforms="${pkg}:my_platform" ${pkg}:a --execution_log_json_file out.txt || fail "Test failed"
|
516 | 538 | grep "platform_key" out.txt || fail "Did not find the platform key"
|
|
0 commit comments