Merge "scan and run test_ methods"
This commit is contained in:
committed by
Gerrit Code Review
commit
b545f49f06
@@ -890,34 +890,4 @@ function test_queryview_null_build() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
test_smoke
|
scan_and_run_tests
|
||||||
test_null_build
|
|
||||||
test_soong_docs_smoke
|
|
||||||
test_null_build_after_soong_docs
|
|
||||||
test_soong_build_rebuilt_if_blueprint_changes
|
|
||||||
test_glob_noop_incremental
|
|
||||||
test_add_file_to_glob
|
|
||||||
test_add_android_bp
|
|
||||||
test_change_android_bp
|
|
||||||
test_delete_android_bp
|
|
||||||
test_add_file_to_soong_build
|
|
||||||
test_glob_during_bootstrapping
|
|
||||||
test_soong_build_rerun_iff_environment_changes
|
|
||||||
test_create_global_include_directory
|
|
||||||
test_multiple_soong_build_modes
|
|
||||||
test_dump_json_module_graph
|
|
||||||
test_json_module_graph_back_and_forth_null_build
|
|
||||||
test_write_to_source_tree
|
|
||||||
test_queryview_smoke
|
|
||||||
test_queryview_null_build
|
|
||||||
test_bp2build_smoke
|
|
||||||
test_bp2build_generates_marker_file
|
|
||||||
test_bp2build_null_build
|
|
||||||
test_bp2build_back_and_forth_null_build
|
|
||||||
test_bp2build_add_android_bp
|
|
||||||
test_bp2build_add_irrelevant_file
|
|
||||||
test_bp2build_add_to_glob
|
|
||||||
test_bp2build_bazel_workspace_structure
|
|
||||||
test_bp2build_bazel_workspace_add_file
|
|
||||||
test_bp2build_build_file_precedence
|
|
||||||
test_bp2build_reports_multiple_errors
|
|
||||||
|
@@ -8,7 +8,7 @@ source "$(dirname "$0")/lib.sh"
|
|||||||
|
|
||||||
readonly GENERATED_BUILD_FILE_NAME="BUILD.bazel"
|
readonly GENERATED_BUILD_FILE_NAME="BUILD.bazel"
|
||||||
|
|
||||||
function test_bp2build_null_build() {
|
function test_bp2build_null_build {
|
||||||
setup
|
setup
|
||||||
run_soong bp2build
|
run_soong bp2build
|
||||||
local -r output_mtime1=$(stat -c "%y" out/soong/bp2build_workspace_marker)
|
local -r output_mtime1=$(stat -c "%y" out/soong/bp2build_workspace_marker)
|
||||||
@@ -21,9 +21,7 @@ function test_bp2build_null_build() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
test_bp2build_null_build
|
function test_bp2build_null_build_with_globs {
|
||||||
|
|
||||||
function test_bp2build_null_build_with_globs() {
|
|
||||||
setup
|
setup
|
||||||
|
|
||||||
mkdir -p foo/bar
|
mkdir -p foo/bar
|
||||||
@@ -46,8 +44,6 @@ EOF
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
test_bp2build_null_build_with_globs
|
|
||||||
|
|
||||||
function test_different_relative_outdir {
|
function test_different_relative_outdir {
|
||||||
setup
|
setup
|
||||||
|
|
||||||
@@ -68,8 +64,6 @@ EOF
|
|||||||
(export OUT_DIR=$outdir; run_soong bp2build && run_bazel build --config=bp2build //a:g)
|
(export OUT_DIR=$outdir; run_soong bp2build && run_bazel build --config=bp2build //a:g)
|
||||||
}
|
}
|
||||||
|
|
||||||
test_different_relative_outdir
|
|
||||||
|
|
||||||
function test_different_absolute_outdir {
|
function test_different_absolute_outdir {
|
||||||
setup
|
setup
|
||||||
|
|
||||||
@@ -90,9 +84,7 @@ EOF
|
|||||||
(export OUT_DIR=$outdir; run_soong bp2build && run_bazel build --config=bp2build //a:g)
|
(export OUT_DIR=$outdir; run_soong bp2build && run_bazel build --config=bp2build //a:g)
|
||||||
}
|
}
|
||||||
|
|
||||||
test_different_absolute_outdir
|
function _bp2build_generates_all_buildfiles {
|
||||||
|
|
||||||
function test_bp2build_generates_all_buildfiles {
|
|
||||||
setup
|
setup
|
||||||
|
|
||||||
mkdir -p foo/convertible_soong_module
|
mkdir -p foo/convertible_soong_module
|
||||||
@@ -157,10 +149,12 @@ EOF
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_save_trap=$(trap -p EXIT)
|
function test_bp2build_generates_all_buildfiles {
|
||||||
trap '[[ $? -ne 0 ]] && echo Are you running this locally? Try changing --sandbox_tmpfs_path to something other than /tmp/ in build/bazel/linux.bazelrc.' EXIT
|
_save_trap=$(trap -p EXIT)
|
||||||
test_bp2build_generates_all_buildfiles
|
trap '[[ $? -ne 0 ]] && echo Are you running this locally? Try changing --sandbox_tmpfs_path to something other than /tmp/ in build/bazel/linux.bazelrc.' EXIT
|
||||||
eval ${_save_trap}
|
_bp2build_generates_all_buildfiles
|
||||||
|
eval "${_save_trap}"
|
||||||
|
}
|
||||||
|
|
||||||
function test_cc_correctness {
|
function test_cc_correctness {
|
||||||
setup
|
setup
|
||||||
@@ -213,8 +207,6 @@ EOF
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
test_cc_correctness
|
|
||||||
|
|
||||||
# Regression test for the following failure during symlink forest creation:
|
# Regression test for the following failure during symlink forest creation:
|
||||||
#
|
#
|
||||||
# Cannot stat '/tmp/st.rr054/foo/bar/unresolved_symlink': stat /tmp/st.rr054/foo/bar/unresolved_symlink: no such file or directory
|
# Cannot stat '/tmp/st.rr054/foo/bar/unresolved_symlink': stat /tmp/st.rr054/foo/bar/unresolved_symlink: no such file or directory
|
||||||
@@ -239,4 +231,4 @@ EOF
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
test_bp2build_null_build_with_unresolved_symlink_in_source
|
scan_and_run_tests
|
||||||
|
13
tests/lib.sh
13
tests/lib.sh
@@ -150,3 +150,16 @@ info "Mock top: $MOCK_TOP"
|
|||||||
export ALLOW_MISSING_DEPENDENCIES=true
|
export ALLOW_MISSING_DEPENDENCIES=true
|
||||||
export ALLOW_BP_UNDER_SYMLINKS=true
|
export ALLOW_BP_UNDER_SYMLINKS=true
|
||||||
warmup_mock_top
|
warmup_mock_top
|
||||||
|
|
||||||
|
function scan_and_run_tests {
|
||||||
|
# find all test_ functions
|
||||||
|
# NB "declare -F" output is sorted, hence test order is deterministic
|
||||||
|
readarray -t test_fns < <(declare -F | sed -n -e 's/^declare -f \(test_.*\)$/\1/p')
|
||||||
|
info "Found ${#test_fns[*]} tests"
|
||||||
|
if [[ ${#test_fns[*]} -eq 0 ]]; then
|
||||||
|
fail "No tests found"
|
||||||
|
fi
|
||||||
|
for f in ${test_fns[*]}; do
|
||||||
|
$f
|
||||||
|
done
|
||||||
|
}
|
Reference in New Issue
Block a user