scons: Ensure style_hooks check exits if hook cannot install
If the pre-commit could not be installed the compilation would continue as the exit code from running the pre-commit install script was not read or processed. This commit adds a check. If the install is unsuccessful the users is asked whether they want to continue the compilation or not. This check can be ignored with the '--ignore-style'. The tests have been updated to include this flag in all cases we compile gem5 to ensure tests remain automated and uninterrupted on Kokoro/Jenkins. Change-Id: Iaf4db71300883b828b00d77784c9bb46b2698f89 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63012 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
committed by
Bobby Bruce
parent
92ab557947
commit
700f64c1c1
@@ -87,7 +87,24 @@ def install_style_hooks(env):
|
||||
|
||||
pre_commit_install = env.Dir("#util").File("pre-commit-install.sh")
|
||||
|
||||
subprocess.call(str(pre_commit_install), shell=True)
|
||||
ret = subprocess.call(str(pre_commit_install), shell=True)
|
||||
if ret != 0:
|
||||
print(
|
||||
"It is strongly recommended you install the pre-commit hooks "
|
||||
"before working with gem5. Do you want to continue compilation "
|
||||
"(y/n)?"
|
||||
)
|
||||
while True:
|
||||
response = input().lower().strip()
|
||||
if response in {"yes", "ye", "y"}:
|
||||
return
|
||||
elif response in {"no", "n"}:
|
||||
sys.exit(1)
|
||||
else:
|
||||
print(
|
||||
f"Could not parse answer '{response}'. Do you want to "
|
||||
"continue compilation (y/n)?"
|
||||
)
|
||||
|
||||
|
||||
def generate(env):
|
||||
|
||||
@@ -129,7 +129,7 @@ for compiler in ${images[@]}; do
|
||||
{
|
||||
docker run --rm -v "${gem5_root}":"/gem5" -u $UID:$GID \
|
||||
-w /gem5 --memory="${docker_mem_limit}" $repo_name \
|
||||
/usr/bin/env python3 /usr/bin/scons \
|
||||
/usr/bin/env python3 /usr/bin/scons --ignore-style \
|
||||
"${build_out}" "${build_args}"
|
||||
}>"${build_stdout}" 2>"${build_stderr}"
|
||||
result=$?
|
||||
|
||||
@@ -51,4 +51,4 @@ PRE_COMMIT_HOME=/tmp/pre-commit-cache pre-commit run \
|
||||
# Once complete, run the Google Tests
|
||||
cd tests
|
||||
./main.py run -j4 -t4 gem5 -vv && scons -C .. --no-compress-debug \
|
||||
build/ARM/unittests.opt
|
||||
--ignore-style build/ARM/unittests.opt
|
||||
|
||||
@@ -68,4 +68,5 @@ docker run -u $UID:$GID --volume $(pwd):$(pwd) -w $(pwd) --rm \
|
||||
rm -rf build
|
||||
docker run -u $UID:$GID --volume $(pwd):$(pwd) -w $(pwd) --rm \
|
||||
"${DOCKER_IMAGE_CLANG_COMPILE}" /usr/bin/env python3 /usr/bin/scons \
|
||||
build/ARM_MESI_Three_Level_HTM/gem5.fast -j4 --no-compress-debug
|
||||
build/ARM_MESI_Three_Level_HTM/gem5.fast -j4 --no-compress-debug \
|
||||
--ignore-style
|
||||
|
||||
@@ -71,7 +71,8 @@ build_target () {
|
||||
"${gem5_root}" --memory="${docker_mem_limit}" --rm \
|
||||
gcr.io/gem5-test/ubuntu-20.04_all-dependencies:latest \
|
||||
bash -c "scons build/${isa}/gem5.opt -j${compile_threads} \
|
||||
|| (rm -rf build && scons build/${isa}/gem5.opt -j${compile_threads})"
|
||||
--ignore-style || (rm -rf build && scons build/${isa}/gem5.opt \
|
||||
-j${compile_threads} --ignore-style)"
|
||||
}
|
||||
|
||||
unit_test () {
|
||||
@@ -80,7 +81,8 @@ unit_test () {
|
||||
docker run -u $UID:$GID --volume "${gem5_root}":"${gem5_root}" -w \
|
||||
"${gem5_root}" --memory="${docker_mem_limit}" --rm \
|
||||
gcr.io/gem5-test/ubuntu-20.04_all-dependencies:latest \
|
||||
scons build/NULL/unittests.${build} -j${compile_threads}
|
||||
scons build/NULL/unittests.${build} -j${compile_threads} \
|
||||
--ignore-style
|
||||
}
|
||||
|
||||
# Ensure we have the latest docker images.
|
||||
@@ -121,8 +123,9 @@ docker pull gcr.io/gem5-test/gcn-gpu:latest
|
||||
docker run --rm -u $UID:$GID --volume "${gem5_root}":"${gem5_root}" -w \
|
||||
"${gem5_root}" --memory="${docker_mem_limit}" \
|
||||
gcr.io/gem5-test/gcn-gpu:latest bash -c \
|
||||
"scons build/${gpu_isa}/gem5.opt -j${compile_threads} \
|
||||
|| (rm -rf build && scons build/${gpu_isa}/gem5.opt -j${compile_threads})"
|
||||
"scons build/${gpu_isa}/gem5.opt -j${compile_threads} --ignore-style \
|
||||
|| (rm -rf build && scons build/${gpu_isa}/gem5.opt \
|
||||
-j${compile_threads} --ignore-style)"
|
||||
|
||||
# get square
|
||||
wget -qN http://dist.gem5.org/dist/develop/test-progs/square/square
|
||||
@@ -169,7 +172,8 @@ build_and_run_SST () {
|
||||
docker run -u $UID:$GID --volume "${gem5_root}":"${gem5_root}" -w \
|
||||
"${gem5_root}" --rm --memory="${docker_mem_limit}" \
|
||||
gcr.io/gem5-test/sst-env:latest bash -c "\
|
||||
scons build/${isa}/libgem5_${variant}.so -j${compile_threads} --without-tcmalloc; \
|
||||
scons build/${isa}/libgem5_${variant}.so -j${compile_threads} \
|
||||
--without-tcmalloc --ignore-style; \
|
||||
cd ext/sst; \
|
||||
make clean; make -j ${compile_threads}; \
|
||||
sst --add-lib-path=./ sst/example.py; \
|
||||
@@ -183,7 +187,7 @@ build_and_run_systemc () {
|
||||
docker run -u $UID:$GID --volume "${gem5_root}":"${gem5_root}" -w \
|
||||
"${gem5_root}" --memory="${docker_mem_limit}" --rm \
|
||||
gcr.io/gem5-test/ubuntu-20.04_all-dependencies:latest bash -c "\
|
||||
scons -j${compile_threads} build/ARM/gem5.opt; \
|
||||
scons -j${compile_threads} --ignore-style build/ARM/gem5.opt; \
|
||||
scons --with-cxx-config --without-python --without-tcmalloc USE_SYSTEMC=0 \
|
||||
-j${compile_threads} build/ARM/libgem5_opt.so \
|
||||
"
|
||||
|
||||
@@ -118,15 +118,16 @@ docker build -t hacc-test-weekly ${gem5_root}/gem5-resources/src/gpu/halo-finder
|
||||
|
||||
docker run --rm -u $UID:$GID --volume "${gem5_root}":"${gem5_root}" -w \
|
||||
"${gem5_root}" --memory="${docker_mem_limit}" hacc-test-weekly bash -c \
|
||||
"scons build/${gpu_isa}/gem5.opt -j${threads} \
|
||||
|| rm -rf build && scons build/${gpu_isa}/gem5.opt -j${threads}"
|
||||
"scons build/${gpu_isa}/gem5.opt -j${threads} --ignore-style \
|
||||
|| rm -rf build && scons build/${gpu_isa}/gem5.opt -j${threads} \
|
||||
--ignore-style"
|
||||
|
||||
# Some of the apps we test use m5ops (and x86), so compile them for x86
|
||||
# Note: setting TERM in the environment is necessary as scons fails for m5ops if
|
||||
# it is not set.
|
||||
docker run --rm -u $UID:$GID --volume "${gem5_root}":"${gem5_root}" -w \
|
||||
"${gem5_root}/util/m5" --memory="${docker_mem_limit}" hacc-test-weekly bash -c \
|
||||
"export TERM=xterm-256color ; scons build/x86/out/m5"
|
||||
"export TERM=xterm-256color ; scons build/x86/out/m5 --ignore-style"
|
||||
|
||||
# test LULESH
|
||||
# build LULESH
|
||||
|
||||
Reference in New Issue
Block a user