@@ -3296,7 +3296,7 @@ EOF
3296
3296
//a:consumer >& $TEST_log || fail " Failed to build without remote cache"
3297
3297
}
3298
3298
3299
- function test_uploader_respsect_no_cache () {
3299
+ function test_uploader_respect_no_cache () {
3300
3300
mkdir -p a
3301
3301
cat > a/BUILD << EOF
3302
3302
genrule(
@@ -3318,7 +3318,34 @@ EOF
3318
3318
expect_log " command.profile.gz.*bytestream://" || fail " should upload profile data"
3319
3319
}
3320
3320
3321
- function test_uploader_respsect_no_cache_trees() {
3321
+ function test_uploader_alias_action_respect_no_cache() {
3322
+ mkdir -p a
3323
+ cat > a/BUILD << EOF
3324
+ genrule(
3325
+ name = 'foo',
3326
+ outs = ["foo.txt"],
3327
+ cmd = "echo \"foo bar\" > \$ @",
3328
+ tags = ["no-cache"],
3329
+ )
3330
+
3331
+ alias(
3332
+ name = 'foo-alias',
3333
+ actual = '//a:foo',
3334
+ )
3335
+ EOF
3336
+
3337
+ bazel build \
3338
+ --remote_cache=grpc://localhost:${worker_port} \
3339
+ --incompatible_remote_build_event_upload_respect_no_cache \
3340
+ --build_event_json_file=bep.json \
3341
+ //a:foo-alias >& $TEST_log || fail " Failed to build"
3342
+
3343
+ cat bep.json > $TEST_log
3344
+ expect_not_log " a:foo.*bytestream://"
3345
+ expect_log " command.profile.gz.*bytestream://"
3346
+ }
3347
+
3348
+ function test_uploader_respect_no_cache_trees() {
3322
3349
mkdir -p a
3323
3350
cat > a/output_dir.bzl << 'EOF '
3324
3351
def _gen_output_dir_impl(ctx):
@@ -3365,7 +3392,7 @@ EOF
3365
3392
expect_log " command.profile.gz.*bytestream://" || fail " should upload profile data"
3366
3393
}
3367
3394
3368
- function test_uploader_respsect_no_upload_results () {
3395
+ function test_uploader_respect_no_upload_results () {
3369
3396
mkdir -p a
3370
3397
cat > a/BUILD << EOF
3371
3398
genrule(
@@ -3387,7 +3414,7 @@ EOF
3387
3414
expect_log " command.profile.gz.*bytestream://" || fail " should upload profile data"
3388
3415
}
3389
3416
3390
- function test_uploader_respsect_no_upload_results_combined_cache () {
3417
+ function test_uploader_respect_no_upload_results_combined_cache () {
3391
3418
mkdir -p a
3392
3419
cat > a/BUILD << EOF
3393
3420
genrule(
@@ -3397,9 +3424,11 @@ genrule(
3397
3424
)
3398
3425
EOF
3399
3426
3427
+ cache_dir=$( mktemp -d)
3428
+
3400
3429
bazel build \
3401
3430
--remote_cache=grpc://localhost:${worker_port} \
3402
- --disk_cache=" ${TEST_TMPDIR} /disk_cache " \
3431
+ --disk_cache=$cache_dir \
3403
3432
--remote_upload_local_results=false \
3404
3433
--incompatible_remote_build_event_upload_respect_no_cache \
3405
3434
--build_event_json_file=bep.json \
@@ -3409,7 +3438,65 @@ EOF
3409
3438
expect_not_log " a:foo.*bytestream://" || fail " local files are converted"
3410
3439
expect_log " command.profile.gz.*bytestream://" || fail " should upload profile data"
3411
3440
remote_cas_files=" $( count_remote_cas_files) "
3412
- [[ " $remote_cas_files " == 1 ]] || fail " Expected 1 remote action cache entries, not $remote_cas_files "
3441
+ [[ " $remote_cas_files " == 1 ]] || fail " Expected 1 remote cas entries, not $remote_cas_files "
3442
+ }
3443
+
3444
+ function test_uploader_ignore_disk_cache_of_combined_cache() {
3445
+ mkdir -p a
3446
+ cat > a/BUILD << EOF
3447
+ genrule(
3448
+ name = 'foo',
3449
+ outs = ["foo.txt"],
3450
+ cmd = "echo \"foo bar\" > \$ @",
3451
+ tags = ["no-cache"],
3452
+ )
3453
+ EOF
3454
+
3455
+ cache_dir=$( mktemp -d)
3456
+
3457
+ bazel build \
3458
+ --remote_cache=grpc://localhost:${worker_port} \
3459
+ --disk_cache=$cache_dir \
3460
+ --incompatible_remote_build_event_upload_respect_no_cache \
3461
+ --build_event_json_file=bep.json \
3462
+ //a:foo >& $TEST_log || fail " Failed to build"
3463
+
3464
+ cat bep.json > $TEST_log
3465
+ expect_not_log " a:foo.*bytestream://" || fail " local files are converted"
3466
+ expect_log " command.profile.gz.*bytestream://" || fail " should upload profile data"
3467
+
3468
+ disk_cas_files=" $( count_disk_cas_files $cache_dir ) "
3469
+ [[ " $disk_cas_files " == 0 ]] || fail " Expected 0 disk cas entries, not $disk_cas_files "
3470
+ }
3471
+
3472
+ function test_uploader_incompatible_remote_results_ignore_disk() {
3473
+ mkdir -p a
3474
+ cat > a/BUILD << EOF
3475
+ genrule(
3476
+ name = 'foo',
3477
+ outs = ["foo.txt"],
3478
+ cmd = "echo \"foo bar\" > \$ @",
3479
+ tags = ["no-remote"],
3480
+ )
3481
+ EOF
3482
+
3483
+ cache_dir=$( mktemp -d)
3484
+
3485
+ bazel build \
3486
+ --remote_cache=grpc://localhost:${worker_port} \
3487
+ --disk_cache=$cache_dir \
3488
+ --incompatible_remote_build_event_upload_respect_no_cache \
3489
+ --incompatible_remote_results_ignore_disk \
3490
+ --build_event_json_file=bep.json \
3491
+ //a:foo >& $TEST_log || fail " Failed to build"
3492
+
3493
+ cat bep.json > $TEST_log
3494
+ expect_not_log " a:foo.*bytestream://" || fail " local files are converted"
3495
+ expect_log " command.profile.gz.*bytestream://" || fail " should upload profile data"
3496
+
3497
+ disk_cas_files=" $( count_disk_cas_files $cache_dir ) "
3498
+ # foo.txt, stdout and stderr for action 'foo'
3499
+ [[ " $disk_cas_files " == 3 ]] || fail " Expected 3 disk cas entries, not $disk_cas_files "
3413
3500
}
3414
3501
3415
3502
run_suite " Remote execution and remote cache tests"
0 commit comments