Skip to content

Commit dc54b01

Browse files
committed
tests: create temp files after skip check
We have a bunch of skip checks, which prevent tests from running if the test doesn't apply (e.g. shellcheck when commit has no shell scripts). Make sure we create temp files for output only after the check, otherwise we won't delete them. Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 45d8482 commit dc54b01

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

tests/patch/build_clang_rust/build_clang_rust.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ cc=clang
77
output_dir=build_clang_rust/
88
ncpu=$(grep -c processor /proc/cpuinfo)
99
build_flags="-Oline -j $ncpu W=1"
10-
tmpfile_o=$(mktemp)
11-
tmpfile_n=$(mktemp)
1210
rc=0
1311

1412
prep_config() {
@@ -94,6 +92,9 @@ echo "Baseline building the tree"
9492
prep_config
9593
make LLVM=1 O=$output_dir $build_flags
9694

95+
tmpfile_o=$(mktemp)
96+
tmpfile_n=$(mktemp)
97+
9798
git checkout -q HEAD~
9899

99100
echo "Building the tree before the patch"

tests/patch/build_tools/build_tools.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
output_dir=build_tools/
55
ncpu=$(grep -c processor /proc/cpuinfo)
66
build_flags="-Oline -j $ncpu"
7-
tmpfile_o=$(mktemp)
8-
tmpfile_n=$(mktemp)
97
rc=0
108

119
pr() {
@@ -18,6 +16,9 @@ if ! git diff --name-only HEAD~ | grep -q -E "^(include)|(tools)/"; then
1816
exit 0
1917
fi
2018

19+
tmpfile_o=$(mktemp)
20+
tmpfile_n=$(mktemp)
21+
2122
# Looks like tools inherit WERROR, otherwise
2223
make O=$output_dir allmodconfig
2324
./scripts/config --file $output_dir/.config -d werror

tests/patch/pylint/pylint.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# SPDX-License-Identifier: GPL-2.0
33

44
HEAD=$(git rev-parse HEAD)
5-
tmpfile_o=$(mktemp)
6-
tmpfile_n=$(mktemp)
75
rc=0
86

97
pr() {
@@ -17,6 +15,9 @@ then
1715
exit 0
1816
fi
1917

18+
tmpfile_o=$(mktemp)
19+
tmpfile_n=$(mktemp)
20+
2021
echo "Redirect to $tmpfile_o and $tmpfile_n"
2122

2223
echo "Tree base:"

tests/patch/shellcheck/shellcheck.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# SPDX-License-Identifier: GPL-2.0
33

44
HEAD=$(git rev-parse HEAD)
5-
tmpfile_o=$(mktemp)
6-
tmpfile_n=$(mktemp)
75
rc=0
86

97
pr() {
@@ -17,6 +15,9 @@ then
1715
exit 0
1816
fi
1917

18+
tmpfile_o=$(mktemp)
19+
tmpfile_n=$(mktemp)
20+
2021
echo "Redirect to $tmpfile_o and $tmpfile_n"
2122

2223
echo "Tree base:"

0 commit comments

Comments
 (0)