blob: b704222e20ce6ac6fe3c980fee2dbf7b50e7c7db [file] [log] [blame]
MarkDacek23a41202023-09-21 19:24:54 +00001#!/bin/bash -eu
2
3set -o pipefail
4
5# Tests that symlink_Forest will rerun if soong_build has schanged
6
7source "$(dirname "$0")/lib.sh"
8
9function test_symlink_forest_reruns {
10 setup
11
12 mkdir -p a
13 touch a/g.txt
14 cat > a/Android.bp <<'EOF'
15filegroup {
16 name: "g",
17 srcs: ["g.txt"],
18 }
19EOF
20
21 run_soong g
22
23 mtime=`cat out/soong/workspace/soong_build_mtime`
24 # rerun with no changes - ensure that it hasn't changed
25 run_soong g
26 newmtime=`cat out/soong/workspace/soong_build_mtime`
27 if [[ ! "$mtime" == "$mtime" ]]; then
28 fail "symlink forest reran when it shouldn't have"
29 fi
30
31 # change exit codes to force a soong_build rebuild.
32 sed -i 's/os.Exit(1)/os.Exit(2)/g' build/soong/bp2build/symlink_forest.go
33
34 run_soong g
35 newmtime=`cat out/soong/workspace/soong_build_mtime`
36 if [[ "$mtime" == "$newmtime" ]]; then
37 fail "symlink forest did not rerun when it should have"
38 fi
39
40}
41
42scan_and_run_tests