Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 1 | #!/bin/bash -eu |
| 2 | |
Rupert Shuttleworth | 2a4fc3e | 2021-04-21 07:10:09 -0400 | [diff] [blame] | 3 | set -o pipefail |
| 4 | |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 5 | # This test exercises the bootstrapping process of the build system |
| 6 | # in a source tree that only contains enough files for Bazel and Soong to work. |
| 7 | |
Lukacs T. Berki | 3b730c4 | 2021-04-08 13:21:13 +0200 | [diff] [blame] | 8 | source "$(dirname "$0")/lib.sh" |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 9 | |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 10 | readonly GENERATED_BUILD_FILE_NAME="BUILD.bazel" |
| 11 | |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 12 | function test_smoke { |
| 13 | setup |
| 14 | run_soong |
| 15 | } |
| 16 | |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 17 | function test_null_build() { |
| 18 | setup |
| 19 | run_soong |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 20 | local bootstrap_mtime1=$(stat -c "%y" out/soong/bootstrap.ninja) |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 21 | local output_mtime1=$(stat -c "%y" out/soong/build.ninja) |
| 22 | run_soong |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 23 | local bootstrap_mtime2=$(stat -c "%y" out/soong/bootstrap.ninja) |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 24 | local output_mtime2=$(stat -c "%y" out/soong/build.ninja) |
| 25 | |
| 26 | if [[ "$bootstrap_mtime1" == "$bootstrap_mtime2" ]]; then |
| 27 | # Bootstrapping is always done. It doesn't take a measurable amount of time. |
| 28 | fail "Bootstrap Ninja file did not change on null build" |
| 29 | fi |
| 30 | |
| 31 | if [[ "$output_mtime1" != "$output_mtime2" ]]; then |
| 32 | fail "Output Ninja file changed on null build" |
| 33 | fi |
| 34 | } |
| 35 | |
| 36 | function test_soong_build_rebuilt_if_blueprint_changes() { |
| 37 | setup |
| 38 | run_soong |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 39 | local mtime1=$(stat -c "%y" out/soong/bootstrap.ninja) |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 40 | |
| 41 | sed -i 's/pluginGenSrcCmd/pluginGenSrcCmd2/g' build/blueprint/bootstrap/bootstrap.go |
| 42 | |
| 43 | run_soong |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 44 | local mtime2=$(stat -c "%y" out/soong/bootstrap.ninja) |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 45 | |
| 46 | if [[ "$mtime1" == "$mtime2" ]]; then |
| 47 | fail "Bootstrap Ninja file did not change" |
| 48 | fi |
| 49 | } |
| 50 | |
| 51 | function test_change_android_bp() { |
| 52 | setup |
| 53 | mkdir -p a |
| 54 | cat > a/Android.bp <<'EOF' |
| 55 | python_binary_host { |
| 56 | name: "my_little_binary_host", |
| 57 | srcs: ["my_little_binary_host.py"] |
| 58 | } |
| 59 | EOF |
| 60 | touch a/my_little_binary_host.py |
| 61 | run_soong |
| 62 | |
| 63 | grep -q "^# Module:.*my_little_binary_host" out/soong/build.ninja || fail "module not found" |
| 64 | |
| 65 | cat > a/Android.bp <<'EOF' |
| 66 | python_binary_host { |
| 67 | name: "my_great_binary_host", |
| 68 | srcs: ["my_great_binary_host.py"] |
| 69 | } |
| 70 | EOF |
| 71 | touch a/my_great_binary_host.py |
| 72 | run_soong |
| 73 | |
| 74 | grep -q "^# Module:.*my_little_binary_host" out/soong/build.ninja && fail "old module found" |
| 75 | grep -q "^# Module:.*my_great_binary_host" out/soong/build.ninja || fail "new module not found" |
| 76 | } |
| 77 | |
| 78 | |
| 79 | function test_add_android_bp() { |
| 80 | setup |
| 81 | run_soong |
| 82 | local mtime1=$(stat -c "%y" out/soong/build.ninja) |
| 83 | |
| 84 | mkdir -p a |
| 85 | cat > a/Android.bp <<'EOF' |
| 86 | python_binary_host { |
| 87 | name: "my_little_binary_host", |
| 88 | srcs: ["my_little_binary_host.py"] |
| 89 | } |
| 90 | EOF |
| 91 | touch a/my_little_binary_host.py |
| 92 | run_soong |
| 93 | |
| 94 | local mtime2=$(stat -c "%y" out/soong/build.ninja) |
| 95 | if [[ "$mtime1" == "$mtime2" ]]; then |
| 96 | fail "Output Ninja file did not change" |
| 97 | fi |
| 98 | |
| 99 | grep -q "^# Module:.*my_little_binary_host$" out/soong/build.ninja || fail "New module not in output" |
| 100 | |
| 101 | run_soong |
| 102 | } |
| 103 | |
| 104 | function test_delete_android_bp() { |
| 105 | setup |
| 106 | mkdir -p a |
| 107 | cat > a/Android.bp <<'EOF' |
| 108 | python_binary_host { |
| 109 | name: "my_little_binary_host", |
| 110 | srcs: ["my_little_binary_host.py"] |
| 111 | } |
| 112 | EOF |
| 113 | touch a/my_little_binary_host.py |
| 114 | run_soong |
| 115 | |
| 116 | grep -q "^# Module:.*my_little_binary_host$" out/soong/build.ninja || fail "Module not in output" |
| 117 | |
| 118 | rm a/Android.bp |
| 119 | run_soong |
| 120 | |
Lukacs T. Berki | f8e2428 | 2021-04-14 10:31:00 +0200 | [diff] [blame] | 121 | if grep -q "^# Module:.*my_little_binary_host$" out/soong/build.ninja; then |
| 122 | fail "Old module in output" |
| 123 | fi |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 124 | } |
| 125 | |
Colin Cross | 1042595 | 2021-04-12 18:59:18 -0700 | [diff] [blame] | 126 | # Test that an incremental build with a glob doesn't rerun soong_build, and |
| 127 | # only regenerates the globs on the first but not the second incremental build. |
| 128 | function test_glob_noop_incremental() { |
| 129 | setup |
| 130 | |
Colin Cross | b72877f | 2021-04-16 10:09:54 -0700 | [diff] [blame] | 131 | # This test needs to start from a clean build, but setup creates an |
| 132 | # initialized tree that has already been built once. Clear the out |
Lukacs T. Berki | 731bb91 | 2021-04-16 09:16:19 +0200 | [diff] [blame] | 133 | # directory to start from scratch (see b/185591972) |
Colin Cross | b72877f | 2021-04-16 10:09:54 -0700 | [diff] [blame] | 134 | rm -rf out |
| 135 | |
Colin Cross | 1042595 | 2021-04-12 18:59:18 -0700 | [diff] [blame] | 136 | mkdir -p a |
| 137 | cat > a/Android.bp <<'EOF' |
| 138 | python_binary_host { |
| 139 | name: "my_little_binary_host", |
| 140 | srcs: ["*.py"], |
| 141 | } |
| 142 | EOF |
| 143 | touch a/my_little_binary_host.py |
| 144 | run_soong |
| 145 | local ninja_mtime1=$(stat -c "%y" out/soong/build.ninja) |
| 146 | |
Lukacs T. Berki | a806e41 | 2021-09-01 08:57:48 +0200 | [diff] [blame] | 147 | local glob_deps_file=out/soong/globs/build/0.d |
Colin Cross | 1042595 | 2021-04-12 18:59:18 -0700 | [diff] [blame] | 148 | |
| 149 | if [ -e "$glob_deps_file" ]; then |
| 150 | fail "Glob deps file unexpectedly written on first build" |
| 151 | fi |
| 152 | |
| 153 | run_soong |
| 154 | local ninja_mtime2=$(stat -c "%y" out/soong/build.ninja) |
| 155 | |
| 156 | # There is an ineffiencency in glob that requires bpglob to rerun once for each glob to update |
| 157 | # the entry in the .ninja_log. It doesn't update the output file, but we can detect the rerun |
| 158 | # by checking if the deps file was created. |
| 159 | if [ ! -e "$glob_deps_file" ]; then |
| 160 | fail "Glob deps file missing after second build" |
| 161 | fi |
| 162 | |
| 163 | local glob_deps_mtime2=$(stat -c "%y" "$glob_deps_file") |
| 164 | |
| 165 | if [[ "$ninja_mtime1" != "$ninja_mtime2" ]]; then |
| 166 | fail "Ninja file rewritten on null incremental build" |
| 167 | fi |
| 168 | |
| 169 | run_soong |
| 170 | local ninja_mtime3=$(stat -c "%y" out/soong/build.ninja) |
| 171 | local glob_deps_mtime3=$(stat -c "%y" "$glob_deps_file") |
| 172 | |
| 173 | if [[ "$ninja_mtime2" != "$ninja_mtime3" ]]; then |
| 174 | fail "Ninja file rewritten on null incremental build" |
| 175 | fi |
| 176 | |
| 177 | # The bpglob commands should not rerun after the first incremental build. |
| 178 | if [[ "$glob_deps_mtime2" != "$glob_deps_mtime3" ]]; then |
| 179 | fail "Glob deps file rewritten on second null incremental build" |
| 180 | fi |
| 181 | } |
| 182 | |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 183 | function test_add_file_to_glob() { |
| 184 | setup |
| 185 | |
| 186 | mkdir -p a |
| 187 | cat > a/Android.bp <<'EOF' |
| 188 | python_binary_host { |
| 189 | name: "my_little_binary_host", |
| 190 | srcs: ["*.py"], |
| 191 | } |
| 192 | EOF |
| 193 | touch a/my_little_binary_host.py |
| 194 | run_soong |
| 195 | local mtime1=$(stat -c "%y" out/soong/build.ninja) |
| 196 | |
| 197 | touch a/my_little_library.py |
| 198 | run_soong |
| 199 | |
| 200 | local mtime2=$(stat -c "%y" out/soong/build.ninja) |
| 201 | if [[ "$mtime1" == "$mtime2" ]]; then |
| 202 | fail "Output Ninja file did not change" |
| 203 | fi |
| 204 | |
| 205 | grep -q my_little_library.py out/soong/build.ninja || fail "new file is not in output" |
| 206 | } |
| 207 | |
Lukacs T. Berki | f0b3b94 | 2021-03-23 11:46:47 +0100 | [diff] [blame] | 208 | function test_soong_build_rerun_iff_environment_changes() { |
| 209 | setup |
| 210 | |
| 211 | mkdir -p cherry |
| 212 | cat > cherry/Android.bp <<'EOF' |
| 213 | bootstrap_go_package { |
| 214 | name: "cherry", |
| 215 | pkgPath: "android/soong/cherry", |
| 216 | deps: [ |
| 217 | "blueprint", |
| 218 | "soong", |
| 219 | "soong-android", |
| 220 | ], |
| 221 | srcs: [ |
| 222 | "cherry.go", |
| 223 | ], |
| 224 | pluginFor: ["soong_build"], |
| 225 | } |
| 226 | EOF |
| 227 | |
| 228 | cat > cherry/cherry.go <<'EOF' |
| 229 | package cherry |
| 230 | |
| 231 | import ( |
| 232 | "android/soong/android" |
| 233 | "github.com/google/blueprint" |
| 234 | ) |
| 235 | |
| 236 | var ( |
| 237 | pctx = android.NewPackageContext("cherry") |
| 238 | ) |
| 239 | |
| 240 | func init() { |
| 241 | android.RegisterSingletonType("cherry", CherrySingleton) |
| 242 | } |
| 243 | |
| 244 | func CherrySingleton() android.Singleton { |
| 245 | return &cherrySingleton{} |
| 246 | } |
| 247 | |
| 248 | type cherrySingleton struct{} |
| 249 | |
| 250 | func (p *cherrySingleton) GenerateBuildActions(ctx android.SingletonContext) { |
| 251 | cherryRule := ctx.Rule(pctx, "cherry", |
| 252 | blueprint.RuleParams{ |
| 253 | Command: "echo CHERRY IS " + ctx.Config().Getenv("CHERRY") + " > ${out}", |
| 254 | CommandDeps: []string{}, |
| 255 | Description: "Cherry", |
| 256 | }) |
| 257 | |
| 258 | outputFile := android.PathForOutput(ctx, "cherry", "cherry.txt") |
| 259 | var deps android.Paths |
| 260 | |
| 261 | ctx.Build(pctx, android.BuildParams{ |
| 262 | Rule: cherryRule, |
| 263 | Output: outputFile, |
| 264 | Inputs: deps, |
| 265 | }) |
| 266 | } |
| 267 | EOF |
| 268 | |
| 269 | export CHERRY=TASTY |
| 270 | run_soong |
| 271 | grep -q "CHERRY IS TASTY" out/soong/build.ninja \ |
| 272 | || fail "first value of environment variable is not used" |
| 273 | |
| 274 | export CHERRY=RED |
| 275 | run_soong |
| 276 | grep -q "CHERRY IS RED" out/soong/build.ninja \ |
| 277 | || fail "second value of environment variable not used" |
| 278 | local mtime1=$(stat -c "%y" out/soong/build.ninja) |
| 279 | |
| 280 | run_soong |
| 281 | local mtime2=$(stat -c "%y" out/soong/build.ninja) |
| 282 | if [[ "$mtime1" != "$mtime2" ]]; then |
| 283 | fail "Output Ninja file changed when environment variable did not" |
| 284 | fi |
| 285 | |
| 286 | } |
| 287 | |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 288 | function test_add_file_to_soong_build() { |
| 289 | setup |
| 290 | run_soong |
| 291 | local mtime1=$(stat -c "%y" out/soong/build.ninja) |
| 292 | |
| 293 | mkdir -p a |
| 294 | cat > a/Android.bp <<'EOF' |
| 295 | bootstrap_go_package { |
| 296 | name: "picard-soong-rules", |
| 297 | pkgPath: "android/soong/picard", |
| 298 | deps: [ |
| 299 | "blueprint", |
| 300 | "soong", |
| 301 | "soong-android", |
| 302 | ], |
| 303 | srcs: [ |
| 304 | "picard.go", |
| 305 | ], |
| 306 | pluginFor: ["soong_build"], |
| 307 | } |
| 308 | EOF |
| 309 | |
| 310 | cat > a/picard.go <<'EOF' |
| 311 | package picard |
| 312 | |
| 313 | import ( |
| 314 | "android/soong/android" |
| 315 | "github.com/google/blueprint" |
| 316 | ) |
| 317 | |
| 318 | var ( |
| 319 | pctx = android.NewPackageContext("picard") |
| 320 | ) |
| 321 | |
| 322 | func init() { |
| 323 | android.RegisterSingletonType("picard", PicardSingleton) |
| 324 | } |
| 325 | |
| 326 | func PicardSingleton() android.Singleton { |
| 327 | return &picardSingleton{} |
| 328 | } |
| 329 | |
| 330 | type picardSingleton struct{} |
| 331 | |
| 332 | func (p *picardSingleton) GenerateBuildActions(ctx android.SingletonContext) { |
| 333 | picardRule := ctx.Rule(pctx, "picard", |
| 334 | blueprint.RuleParams{ |
| 335 | Command: "echo Make it so. > ${out}", |
| 336 | CommandDeps: []string{}, |
| 337 | Description: "Something quotable", |
| 338 | }) |
| 339 | |
| 340 | outputFile := android.PathForOutput(ctx, "picard", "picard.txt") |
| 341 | var deps android.Paths |
| 342 | |
| 343 | ctx.Build(pctx, android.BuildParams{ |
| 344 | Rule: picardRule, |
| 345 | Output: outputFile, |
| 346 | Inputs: deps, |
| 347 | }) |
| 348 | } |
| 349 | |
| 350 | EOF |
| 351 | |
| 352 | run_soong |
| 353 | local mtime2=$(stat -c "%y" out/soong/build.ninja) |
| 354 | if [[ "$mtime1" == "$mtime2" ]]; then |
| 355 | fail "Output Ninja file did not change" |
| 356 | fi |
| 357 | |
| 358 | grep -q "Make it so" out/soong/build.ninja || fail "New action not present" |
| 359 | } |
| 360 | |
Colin Cross | c02504e | 2021-04-08 10:34:16 -0700 | [diff] [blame] | 361 | # Tests a glob in a build= statement in an Android.bp file, which is interpreted |
| 362 | # during bootstrapping. |
| 363 | function test_glob_during_bootstrapping() { |
| 364 | setup |
| 365 | |
| 366 | mkdir -p a |
| 367 | cat > a/Android.bp <<'EOF' |
| 368 | build=["foo*.bp"] |
| 369 | EOF |
| 370 | cat > a/fooa.bp <<'EOF' |
| 371 | bootstrap_go_package { |
| 372 | name: "picard-soong-rules", |
| 373 | pkgPath: "android/soong/picard", |
| 374 | deps: [ |
| 375 | "blueprint", |
| 376 | "soong", |
| 377 | "soong-android", |
| 378 | ], |
| 379 | srcs: [ |
| 380 | "picard.go", |
| 381 | ], |
| 382 | pluginFor: ["soong_build"], |
| 383 | } |
| 384 | EOF |
| 385 | |
| 386 | cat > a/picard.go <<'EOF' |
| 387 | package picard |
| 388 | |
| 389 | import ( |
| 390 | "android/soong/android" |
| 391 | "github.com/google/blueprint" |
| 392 | ) |
| 393 | |
| 394 | var ( |
| 395 | pctx = android.NewPackageContext("picard") |
| 396 | ) |
| 397 | |
| 398 | func init() { |
| 399 | android.RegisterSingletonType("picard", PicardSingleton) |
| 400 | } |
| 401 | |
| 402 | func PicardSingleton() android.Singleton { |
| 403 | return &picardSingleton{} |
| 404 | } |
| 405 | |
| 406 | type picardSingleton struct{} |
| 407 | |
| 408 | var Message = "Make it so." |
| 409 | |
| 410 | func (p *picardSingleton) GenerateBuildActions(ctx android.SingletonContext) { |
| 411 | picardRule := ctx.Rule(pctx, "picard", |
| 412 | blueprint.RuleParams{ |
| 413 | Command: "echo " + Message + " > ${out}", |
| 414 | CommandDeps: []string{}, |
| 415 | Description: "Something quotable", |
| 416 | }) |
| 417 | |
| 418 | outputFile := android.PathForOutput(ctx, "picard", "picard.txt") |
| 419 | var deps android.Paths |
| 420 | |
| 421 | ctx.Build(pctx, android.BuildParams{ |
| 422 | Rule: picardRule, |
| 423 | Output: outputFile, |
| 424 | Inputs: deps, |
| 425 | }) |
| 426 | } |
| 427 | |
| 428 | EOF |
| 429 | |
| 430 | run_soong |
| 431 | local mtime1=$(stat -c "%y" out/soong/build.ninja) |
| 432 | |
| 433 | grep -q "Make it so" out/soong/build.ninja || fail "Original action not present" |
| 434 | |
| 435 | cat > a/foob.bp <<'EOF' |
| 436 | bootstrap_go_package { |
| 437 | name: "worf-soong-rules", |
| 438 | pkgPath: "android/soong/worf", |
| 439 | deps: [ |
| 440 | "blueprint", |
| 441 | "soong", |
| 442 | "soong-android", |
| 443 | "picard-soong-rules", |
| 444 | ], |
| 445 | srcs: [ |
| 446 | "worf.go", |
| 447 | ], |
| 448 | pluginFor: ["soong_build"], |
| 449 | } |
| 450 | EOF |
| 451 | |
| 452 | cat > a/worf.go <<'EOF' |
| 453 | package worf |
| 454 | |
| 455 | import "android/soong/picard" |
| 456 | |
| 457 | func init() { |
| 458 | picard.Message = "Engage." |
| 459 | } |
| 460 | EOF |
| 461 | |
| 462 | run_soong |
| 463 | local mtime2=$(stat -c "%y" out/soong/build.ninja) |
| 464 | if [[ "$mtime1" == "$mtime2" ]]; then |
| 465 | fail "Output Ninja file did not change" |
| 466 | fi |
| 467 | |
| 468 | grep -q "Engage" out/soong/build.ninja || fail "New action not present" |
| 469 | |
Lukacs T. Berki | f8e2428 | 2021-04-14 10:31:00 +0200 | [diff] [blame] | 470 | if grep -q "Make it so" out/soong/build.ninja; then |
| 471 | fail "Original action still present" |
| 472 | fi |
Colin Cross | c02504e | 2021-04-08 10:34:16 -0700 | [diff] [blame] | 473 | } |
| 474 | |
Lukacs T. Berki | c6012f3 | 2021-09-06 18:31:46 +0200 | [diff] [blame] | 475 | function test_soong_docs_smoke() { |
Lukacs T. Berki | f0b3b94 | 2021-03-23 11:46:47 +0100 | [diff] [blame] | 476 | setup |
Lukacs T. Berki | f0b3b94 | 2021-03-23 11:46:47 +0100 | [diff] [blame] | 477 | |
Lukacs T. Berki | c6012f3 | 2021-09-06 18:31:46 +0200 | [diff] [blame] | 478 | run_soong soong_docs |
| 479 | |
| 480 | [[ -e "out/soong/docs/soong_build.html" ]] || fail "Documentation for main page not created" |
| 481 | [[ -e "out/soong/docs/cc.html" ]] || fail "Documentation for C++ modules not created" |
| 482 | } |
| 483 | |
| 484 | function test_null_build_after_soong_docs() { |
| 485 | setup |
Lukacs T. Berki | 1a86bd2 | 2021-08-19 16:24:30 +0200 | [diff] [blame] | 486 | |
Lukacs T. Berki | f0b3b94 | 2021-03-23 11:46:47 +0100 | [diff] [blame] | 487 | run_soong |
Lukacs T. Berki | c6012f3 | 2021-09-06 18:31:46 +0200 | [diff] [blame] | 488 | local ninja_mtime1=$(stat -c "%y" out/soong/build.ninja) |
Lukacs T. Berki | f0b3b94 | 2021-03-23 11:46:47 +0100 | [diff] [blame] | 489 | |
Lukacs T. Berki | c6012f3 | 2021-09-06 18:31:46 +0200 | [diff] [blame] | 490 | run_soong soong_docs |
| 491 | local docs_mtime1=$(stat -c "%y" out/soong/docs/soong_build.html) |
| 492 | |
| 493 | run_soong soong_docs |
| 494 | local docs_mtime2=$(stat -c "%y" out/soong/docs/soong_build.html) |
| 495 | |
| 496 | if [[ "$docs_mtime1" != "$docs_mtime2" ]]; then |
| 497 | fail "Output Ninja file changed on null build" |
| 498 | fi |
| 499 | |
| 500 | run_soong |
| 501 | local ninja_mtime2=$(stat -c "%y" out/soong/build.ninja) |
| 502 | |
| 503 | if [[ "$ninja_mtime1" != "$ninja_mtime2" ]]; then |
Lukacs T. Berki | f0b3b94 | 2021-03-23 11:46:47 +0100 | [diff] [blame] | 504 | fail "Output Ninja file changed on null build" |
| 505 | fi |
| 506 | } |
| 507 | |
Spandan Das | 0506361 | 2021-06-25 01:39:04 +0000 | [diff] [blame] | 508 | function test_write_to_source_tree { |
| 509 | setup |
| 510 | mkdir -p a |
| 511 | cat > a/Android.bp <<EOF |
| 512 | genrule { |
| 513 | name: "write_to_source_tree", |
| 514 | out: ["write_to_source_tree"], |
| 515 | cmd: "touch file_in_source_tree && touch \$(out)", |
| 516 | } |
| 517 | EOF |
| 518 | readonly EXPECTED_OUT=out/soong/.intermediates/a/write_to_source_tree/gen/write_to_source_tree |
| 519 | readonly ERROR_LOG=${MOCK_TOP}/out/error.log |
| 520 | readonly ERROR_MSG="Read-only file system" |
| 521 | readonly ERROR_HINT_PATTERN="BUILD_BROKEN_SRC_DIR" |
| 522 | # Test in ReadOnly source tree |
| 523 | run_ninja BUILD_BROKEN_SRC_DIR_IS_WRITABLE=false ${EXPECTED_OUT} &> /dev/null && \ |
| 524 | fail "Write to source tree should not work in a ReadOnly source tree" |
| 525 | |
| 526 | if grep -q "${ERROR_MSG}" ${ERROR_LOG} && grep -q "${ERROR_HINT_PATTERN}" ${ERROR_LOG} ; then |
| 527 | echo Error message and error hint found in logs >/dev/null |
| 528 | else |
| 529 | fail "Did not find Read-only error AND error hint in error.log" |
| 530 | fi |
| 531 | |
| 532 | # Test in ReadWrite source tree |
| 533 | run_ninja BUILD_BROKEN_SRC_DIR_IS_WRITABLE=true ${EXPECTED_OUT} &> /dev/null || \ |
| 534 | fail "Write to source tree did not succeed in a ReadWrite source tree" |
| 535 | |
| 536 | if grep -q "${ERROR_MSG}\|${ERROR_HINT_PATTERN}" ${ERROR_LOG} ; then |
| 537 | fail "Found read-only error OR error hint in error.log" |
| 538 | fi |
| 539 | } |
| 540 | |
Chris Parsons | ec1a3dc | 2021-04-20 15:32:07 -0400 | [diff] [blame] | 541 | function test_bp2build_smoke { |
Lukacs T. Berki | f8e2428 | 2021-04-14 10:31:00 +0200 | [diff] [blame] | 542 | setup |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 543 | run_soong bp2build |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 544 | [[ -e out/soong/bp2build_workspace_marker ]] || fail "bp2build marker file not created" |
Lukacs T. Berki | b353cca | 2021-04-16 13:47:36 +0200 | [diff] [blame] | 545 | [[ -e out/soong/workspace ]] || fail "Bazel workspace not created" |
Lukacs T. Berki | d518e1a | 2021-04-14 13:49:50 +0200 | [diff] [blame] | 546 | } |
| 547 | |
Lukacs T. Berki | 56ebaf3 | 2021-08-12 14:03:55 +0200 | [diff] [blame] | 548 | function test_bp2build_generates_marker_file { |
Jingwen Chen | 4fabaf5 | 2021-05-25 02:40:29 +0000 | [diff] [blame] | 549 | setup |
| 550 | create_mock_bazel |
| 551 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 552 | run_soong bp2build |
Jingwen Chen | 4fabaf5 | 2021-05-25 02:40:29 +0000 | [diff] [blame] | 553 | |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 554 | if [[ ! -f "./out/soong/bp2build_workspace_marker" ]]; then |
Lukacs T. Berki | 56ebaf3 | 2021-08-12 14:03:55 +0200 | [diff] [blame] | 555 | fail "Marker file was not generated" |
Jingwen Chen | 4fabaf5 | 2021-05-25 02:40:29 +0000 | [diff] [blame] | 556 | fi |
| 557 | } |
| 558 | |
Chris Parsons | ec1a3dc | 2021-04-20 15:32:07 -0400 | [diff] [blame] | 559 | function test_bp2build_add_android_bp { |
Lukacs T. Berki | d518e1a | 2021-04-14 13:49:50 +0200 | [diff] [blame] | 560 | setup |
| 561 | |
| 562 | mkdir -p a |
| 563 | touch a/a.txt |
| 564 | cat > a/Android.bp <<'EOF' |
| 565 | filegroup { |
| 566 | name: "a", |
| 567 | srcs: ["a.txt"], |
| 568 | bazel_module: { bp2build_available: true }, |
| 569 | } |
| 570 | EOF |
| 571 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 572 | run_soong bp2build |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 573 | [[ -e out/soong/bp2build/a/${GENERATED_BUILD_FILE_NAME} ]] || fail "a/${GENERATED_BUILD_FILE_NAME} not created" |
| 574 | [[ -L out/soong/workspace/a/${GENERATED_BUILD_FILE_NAME} ]] || fail "a/${GENERATED_BUILD_FILE_NAME} not symlinked" |
Lukacs T. Berki | d518e1a | 2021-04-14 13:49:50 +0200 | [diff] [blame] | 575 | |
| 576 | mkdir -p b |
| 577 | touch b/b.txt |
| 578 | cat > b/Android.bp <<'EOF' |
| 579 | filegroup { |
| 580 | name: "b", |
| 581 | srcs: ["b.txt"], |
| 582 | bazel_module: { bp2build_available: true }, |
| 583 | } |
| 584 | EOF |
| 585 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 586 | run_soong bp2build |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 587 | [[ -e out/soong/bp2build/b/${GENERATED_BUILD_FILE_NAME} ]] || fail "a/${GENERATED_BUILD_FILE_NAME} not created" |
| 588 | [[ -L out/soong/workspace/b/${GENERATED_BUILD_FILE_NAME} ]] || fail "a/${GENERATED_BUILD_FILE_NAME} not symlinked" |
Lukacs T. Berki | f8e2428 | 2021-04-14 10:31:00 +0200 | [diff] [blame] | 589 | } |
| 590 | |
Chris Parsons | ec1a3dc | 2021-04-20 15:32:07 -0400 | [diff] [blame] | 591 | function test_bp2build_null_build { |
Lukacs T. Berki | f8e2428 | 2021-04-14 10:31:00 +0200 | [diff] [blame] | 592 | setup |
Lukacs T. Berki | d518e1a | 2021-04-14 13:49:50 +0200 | [diff] [blame] | 593 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 594 | run_soong bp2build |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 595 | local mtime1=$(stat -c "%y" out/soong/bp2build_workspace_marker) |
Lukacs T. Berki | f8e2428 | 2021-04-14 10:31:00 +0200 | [diff] [blame] | 596 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 597 | run_soong bp2build |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 598 | local mtime2=$(stat -c "%y" out/soong/bp2build_workspace_marker) |
Lukacs T. Berki | f8e2428 | 2021-04-14 10:31:00 +0200 | [diff] [blame] | 599 | |
| 600 | if [[ "$mtime1" != "$mtime2" ]]; then |
| 601 | fail "Output Ninja file changed on null build" |
| 602 | fi |
| 603 | } |
| 604 | |
Chris Parsons | ec1a3dc | 2021-04-20 15:32:07 -0400 | [diff] [blame] | 605 | function test_bp2build_add_to_glob { |
Lukacs T. Berki | d518e1a | 2021-04-14 13:49:50 +0200 | [diff] [blame] | 606 | setup |
| 607 | |
| 608 | mkdir -p a |
| 609 | touch a/a1.txt |
| 610 | cat > a/Android.bp <<'EOF' |
| 611 | filegroup { |
| 612 | name: "a", |
| 613 | srcs: ["*.txt"], |
| 614 | bazel_module: { bp2build_available: true }, |
| 615 | } |
| 616 | EOF |
| 617 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 618 | run_soong bp2build |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 619 | grep -q a1.txt "out/soong/bp2build/a/${GENERATED_BUILD_FILE_NAME}" || fail "a1.txt not in ${GENERATED_BUILD_FILE_NAME} file" |
Lukacs T. Berki | d518e1a | 2021-04-14 13:49:50 +0200 | [diff] [blame] | 620 | |
| 621 | touch a/a2.txt |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 622 | run_soong bp2build |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 623 | grep -q a2.txt "out/soong/bp2build/a/${GENERATED_BUILD_FILE_NAME}" || fail "a2.txt not in ${GENERATED_BUILD_FILE_NAME} file" |
Lukacs T. Berki | d518e1a | 2021-04-14 13:49:50 +0200 | [diff] [blame] | 624 | } |
| 625 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 626 | function test_multiple_soong_build_modes() { |
| 627 | setup |
| 628 | run_soong json-module-graph bp2build nothing |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 629 | if [[ ! -f "out/soong/bp2build_workspace_marker" ]]; then |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 630 | fail "bp2build marker file was not generated" |
| 631 | fi |
| 632 | |
| 633 | |
| 634 | if [[ ! -f "out/soong/module-graph.json" ]]; then |
| 635 | fail "JSON file was not created" |
| 636 | fi |
| 637 | |
| 638 | if [[ ! -f "out/soong/build.ninja" ]]; then |
| 639 | fail "Main build.ninja file was not created" |
| 640 | fi |
| 641 | } |
| 642 | |
Lukacs T. Berki | 97bb9f1 | 2021-04-01 18:28:45 +0200 | [diff] [blame] | 643 | function test_dump_json_module_graph() { |
| 644 | setup |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 645 | run_soong json-module-graph |
| 646 | if [[ ! -r "out/soong/module-graph.json" ]]; then |
Lukacs T. Berki | 97bb9f1 | 2021-04-01 18:28:45 +0200 | [diff] [blame] | 647 | fail "JSON file was not created" |
| 648 | fi |
| 649 | } |
| 650 | |
Lukacs T. Berki | e571dc3 | 2021-08-25 14:14:13 +0200 | [diff] [blame] | 651 | function test_json_module_graph_back_and_forth_null_build() { |
| 652 | setup |
| 653 | |
| 654 | run_soong |
| 655 | local ninja_mtime1=$(stat -c "%y" out/soong/build.ninja) |
| 656 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 657 | run_soong json-module-graph |
Lukacs T. Berki | e571dc3 | 2021-08-25 14:14:13 +0200 | [diff] [blame] | 658 | local json_mtime1=$(stat -c "%y" out/soong/module-graph.json) |
| 659 | |
| 660 | run_soong |
| 661 | local ninja_mtime2=$(stat -c "%y" out/soong/build.ninja) |
| 662 | if [[ "$ninja_mtime1" != "$ninja_mtime2" ]]; then |
| 663 | fail "Output Ninja file changed after writing JSON module graph" |
| 664 | fi |
| 665 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 666 | run_soong json-module-graph |
Lukacs T. Berki | e571dc3 | 2021-08-25 14:14:13 +0200 | [diff] [blame] | 667 | local json_mtime2=$(stat -c "%y" out/soong/module-graph.json) |
| 668 | if [[ "$json_mtime1" != "$json_mtime2" ]]; then |
| 669 | fail "JSON module graph file changed after writing Ninja file" |
| 670 | fi |
| 671 | |
| 672 | } |
| 673 | |
| 674 | |
Chris Parsons | ec1a3dc | 2021-04-20 15:32:07 -0400 | [diff] [blame] | 675 | function test_bp2build_bazel_workspace_structure { |
Lukacs T. Berki | b353cca | 2021-04-16 13:47:36 +0200 | [diff] [blame] | 676 | setup |
| 677 | |
| 678 | mkdir -p a/b |
| 679 | touch a/a.txt |
| 680 | touch a/b/b.txt |
| 681 | cat > a/b/Android.bp <<'EOF' |
| 682 | filegroup { |
| 683 | name: "b", |
| 684 | srcs: ["b.txt"], |
| 685 | bazel_module: { bp2build_available: true }, |
| 686 | } |
| 687 | EOF |
| 688 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 689 | run_soong bp2build |
Lukacs T. Berki | b353cca | 2021-04-16 13:47:36 +0200 | [diff] [blame] | 690 | [[ -e out/soong/workspace ]] || fail "Bazel workspace not created" |
| 691 | [[ -d out/soong/workspace/a/b ]] || fail "module directory not a directory" |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 692 | [[ -L "out/soong/workspace/a/b/${GENERATED_BUILD_FILE_NAME}" ]] || fail "${GENERATED_BUILD_FILE_NAME} file not symlinked" |
| 693 | [[ "$(readlink -f out/soong/workspace/a/b/${GENERATED_BUILD_FILE_NAME})" =~ "bp2build/a/b/${GENERATED_BUILD_FILE_NAME}"$ ]] \ |
Lukacs T. Berki | b353cca | 2021-04-16 13:47:36 +0200 | [diff] [blame] | 694 | || fail "BUILD files symlinked at the wrong place" |
| 695 | [[ -L out/soong/workspace/a/b/b.txt ]] || fail "a/b/b.txt not symlinked" |
| 696 | [[ -L out/soong/workspace/a/a.txt ]] || fail "a/b/a.txt not symlinked" |
| 697 | [[ ! -e out/soong/workspace/out ]] || fail "out directory symlinked" |
| 698 | } |
| 699 | |
Chris Parsons | ec1a3dc | 2021-04-20 15:32:07 -0400 | [diff] [blame] | 700 | function test_bp2build_bazel_workspace_add_file { |
Lukacs T. Berki | b353cca | 2021-04-16 13:47:36 +0200 | [diff] [blame] | 701 | setup |
| 702 | |
| 703 | mkdir -p a |
| 704 | touch a/a.txt |
| 705 | cat > a/Android.bp <<EOF |
| 706 | filegroup { |
| 707 | name: "a", |
| 708 | srcs: ["a.txt"], |
| 709 | bazel_module: { bp2build_available: true }, |
| 710 | } |
| 711 | EOF |
| 712 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 713 | run_soong bp2build |
Lukacs T. Berki | b353cca | 2021-04-16 13:47:36 +0200 | [diff] [blame] | 714 | |
| 715 | touch a/a2.txt # No reference in the .bp file needed |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 716 | run_soong bp2build |
Lukacs T. Berki | b353cca | 2021-04-16 13:47:36 +0200 | [diff] [blame] | 717 | [[ -L out/soong/workspace/a/a2.txt ]] || fail "a/a2.txt not symlinked" |
| 718 | } |
| 719 | |
Lukacs T. Berki | b21166e | 2021-04-21 11:58:36 +0200 | [diff] [blame] | 720 | function test_bp2build_build_file_precedence { |
| 721 | setup |
| 722 | |
| 723 | mkdir -p a |
| 724 | touch a/a.txt |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 725 | touch a/${GENERATED_BUILD_FILE_NAME} |
Lukacs T. Berki | b21166e | 2021-04-21 11:58:36 +0200 | [diff] [blame] | 726 | cat > a/Android.bp <<EOF |
| 727 | filegroup { |
| 728 | name: "a", |
| 729 | srcs: ["a.txt"], |
| 730 | bazel_module: { bp2build_available: true }, |
| 731 | } |
| 732 | EOF |
| 733 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 734 | run_soong bp2build |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 735 | [[ -L "out/soong/workspace/a/${GENERATED_BUILD_FILE_NAME}" ]] || fail "${GENERATED_BUILD_FILE_NAME} file not symlinked" |
| 736 | [[ "$(readlink -f out/soong/workspace/a/${GENERATED_BUILD_FILE_NAME})" =~ "bp2build/a/${GENERATED_BUILD_FILE_NAME}"$ ]] \ |
| 737 | || fail "${GENERATED_BUILD_FILE_NAME} files symlinked to the wrong place" |
Lukacs T. Berki | b21166e | 2021-04-21 11:58:36 +0200 | [diff] [blame] | 738 | } |
| 739 | |
| 740 | function test_bp2build_reports_multiple_errors { |
| 741 | setup |
| 742 | |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 743 | mkdir -p "a/${GENERATED_BUILD_FILE_NAME}" |
Lukacs T. Berki | b21166e | 2021-04-21 11:58:36 +0200 | [diff] [blame] | 744 | touch a/a.txt |
| 745 | cat > a/Android.bp <<EOF |
| 746 | filegroup { |
| 747 | name: "a", |
| 748 | srcs: ["a.txt"], |
| 749 | bazel_module: { bp2build_available: true }, |
| 750 | } |
| 751 | EOF |
| 752 | |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 753 | mkdir -p "b/${GENERATED_BUILD_FILE_NAME}" |
Lukacs T. Berki | b21166e | 2021-04-21 11:58:36 +0200 | [diff] [blame] | 754 | touch b/b.txt |
| 755 | cat > b/Android.bp <<EOF |
| 756 | filegroup { |
| 757 | name: "b", |
| 758 | srcs: ["b.txt"], |
| 759 | bazel_module: { bp2build_available: true }, |
| 760 | } |
| 761 | EOF |
| 762 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 763 | if run_soong bp2build >& "$MOCK_TOP/errors"; then |
Lukacs T. Berki | b21166e | 2021-04-21 11:58:36 +0200 | [diff] [blame] | 764 | fail "Build should have failed" |
| 765 | fi |
| 766 | |
Rupert Shuttleworth | 413a7a9 | 2021-05-18 07:47:15 -0400 | [diff] [blame] | 767 | grep -q "a/${GENERATED_BUILD_FILE_NAME}' exist" "$MOCK_TOP/errors" || fail "Error for a/${GENERATED_BUILD_FILE_NAME} not found" |
| 768 | grep -q "b/${GENERATED_BUILD_FILE_NAME}' exist" "$MOCK_TOP/errors" || fail "Error for b/${GENERATED_BUILD_FILE_NAME} not found" |
Lukacs T. Berki | b21166e | 2021-04-21 11:58:36 +0200 | [diff] [blame] | 769 | } |
| 770 | |
Lukacs T. Berki | 56ebaf3 | 2021-08-12 14:03:55 +0200 | [diff] [blame] | 771 | function test_bp2build_back_and_forth_null_build { |
| 772 | setup |
| 773 | |
| 774 | run_soong |
| 775 | local output_mtime1=$(stat -c "%y" out/soong/build.ninja) |
| 776 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 777 | run_soong bp2build |
Lukacs T. Berki | 56ebaf3 | 2021-08-12 14:03:55 +0200 | [diff] [blame] | 778 | local output_mtime2=$(stat -c "%y" out/soong/build.ninja) |
| 779 | if [[ "$output_mtime1" != "$output_mtime2" ]]; then |
| 780 | fail "Output Ninja file changed when switching to bp2build" |
| 781 | fi |
| 782 | |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 783 | local marker_mtime1=$(stat -c "%y" out/soong/bp2build_workspace_marker) |
Lukacs T. Berki | 56ebaf3 | 2021-08-12 14:03:55 +0200 | [diff] [blame] | 784 | |
| 785 | run_soong |
| 786 | local output_mtime3=$(stat -c "%y" out/soong/build.ninja) |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 787 | local marker_mtime2=$(stat -c "%y" out/soong/bp2build_workspace_marker) |
Lukacs T. Berki | 56ebaf3 | 2021-08-12 14:03:55 +0200 | [diff] [blame] | 788 | if [[ "$output_mtime1" != "$output_mtime3" ]]; then |
| 789 | fail "Output Ninja file changed when switching to regular build from bp2build" |
| 790 | fi |
| 791 | if [[ "$marker_mtime1" != "$marker_mtime2" ]]; then |
| 792 | fail "bp2build marker file changed when switching to regular build from bp2build" |
| 793 | fi |
| 794 | |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 795 | run_soong bp2build |
Lukacs T. Berki | 56ebaf3 | 2021-08-12 14:03:55 +0200 | [diff] [blame] | 796 | local output_mtime4=$(stat -c "%y" out/soong/build.ninja) |
Lukacs T. Berki | 90b4334 | 2021-11-02 14:42:04 +0100 | [diff] [blame] | 797 | local marker_mtime3=$(stat -c "%y" out/soong/bp2build_workspace_marker) |
Lukacs T. Berki | 56ebaf3 | 2021-08-12 14:03:55 +0200 | [diff] [blame] | 798 | if [[ "$output_mtime1" != "$output_mtime4" ]]; then |
| 799 | fail "Output Ninja file changed when switching back to bp2build" |
| 800 | fi |
| 801 | if [[ "$marker_mtime1" != "$marker_mtime3" ]]; then |
| 802 | fail "bp2build marker file changed when switching back to bp2build" |
| 803 | fi |
| 804 | } |
| 805 | |
Lukacs T. Berki | 3a82169 | 2021-09-06 17:08:02 +0200 | [diff] [blame] | 806 | function test_queryview_smoke() { |
| 807 | setup |
| 808 | |
| 809 | run_soong queryview |
| 810 | [[ -e out/soong/queryview/WORKSPACE ]] || fail "queryview WORKSPACE file not created" |
| 811 | |
| 812 | } |
| 813 | |
| 814 | function test_queryview_null_build() { |
| 815 | setup |
| 816 | |
| 817 | run_soong queryview |
| 818 | local output_mtime1=$(stat -c "%y" out/soong/queryview.marker) |
| 819 | |
| 820 | run_soong queryview |
| 821 | local output_mtime2=$(stat -c "%y" out/soong/queryview.marker) |
| 822 | |
| 823 | if [[ "$output_mtime1" != "$output_mtime2" ]]; then |
| 824 | fail "Queryview marker file changed on null build" |
| 825 | fi |
| 826 | } |
| 827 | |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 828 | test_smoke |
| 829 | test_null_build |
Lukacs T. Berki | c6012f3 | 2021-09-06 18:31:46 +0200 | [diff] [blame] | 830 | test_soong_docs_smoke |
| 831 | test_null_build_after_soong_docs |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 832 | test_soong_build_rebuilt_if_blueprint_changes |
Lukacs T. Berki | 69ed2a2 | 2021-04-21 12:05:08 +0200 | [diff] [blame] | 833 | test_glob_noop_incremental |
Lukacs T. Berki | d1e3f1f | 2021-03-16 08:55:23 +0100 | [diff] [blame] | 834 | test_add_file_to_glob |
| 835 | test_add_android_bp |
| 836 | test_change_android_bp |
| 837 | test_delete_android_bp |
| 838 | test_add_file_to_soong_build |
Colin Cross | c02504e | 2021-04-08 10:34:16 -0700 | [diff] [blame] | 839 | test_glob_during_bootstrapping |
Lukacs T. Berki | f0b3b94 | 2021-03-23 11:46:47 +0100 | [diff] [blame] | 840 | test_soong_build_rerun_iff_environment_changes |
Lukacs T. Berki | a1b9372 | 2021-09-02 17:23:06 +0200 | [diff] [blame] | 841 | test_multiple_soong_build_modes |
Lukacs T. Berki | 97bb9f1 | 2021-04-01 18:28:45 +0200 | [diff] [blame] | 842 | test_dump_json_module_graph |
Lukacs T. Berki | e571dc3 | 2021-08-25 14:14:13 +0200 | [diff] [blame] | 843 | test_json_module_graph_back_and_forth_null_build |
Spandan Das | 0506361 | 2021-06-25 01:39:04 +0000 | [diff] [blame] | 844 | test_write_to_source_tree |
Lukacs T. Berki | 3a82169 | 2021-09-06 17:08:02 +0200 | [diff] [blame] | 845 | test_queryview_smoke |
| 846 | test_queryview_null_build |
Chris Parsons | ec1a3dc | 2021-04-20 15:32:07 -0400 | [diff] [blame] | 847 | test_bp2build_smoke |
Lukacs T. Berki | 56ebaf3 | 2021-08-12 14:03:55 +0200 | [diff] [blame] | 848 | test_bp2build_generates_marker_file |
Chris Parsons | ec1a3dc | 2021-04-20 15:32:07 -0400 | [diff] [blame] | 849 | test_bp2build_null_build |
Lukacs T. Berki | 56ebaf3 | 2021-08-12 14:03:55 +0200 | [diff] [blame] | 850 | test_bp2build_back_and_forth_null_build |
Chris Parsons | ec1a3dc | 2021-04-20 15:32:07 -0400 | [diff] [blame] | 851 | test_bp2build_add_android_bp |
| 852 | test_bp2build_add_to_glob |
| 853 | test_bp2build_bazel_workspace_structure |
| 854 | test_bp2build_bazel_workspace_add_file |
Lukacs T. Berki | b21166e | 2021-04-21 11:58:36 +0200 | [diff] [blame] | 855 | test_bp2build_build_file_precedence |
| 856 | test_bp2build_reports_multiple_errors |