Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/topic/bbannier/bump-pre-commit-h…
Browse files Browse the repository at this point in the history
…ooks'
  • Loading branch information
bbannier committed Aug 9, 2023
2 parents 46f982c + 3a6a0ac commit 6339085
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 31 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
rev: v0.9.0.5
hooks:
- id: shellcheck
exclude: examples/|testing/tests/.*\.sh
Expand All @@ -15,26 +15,26 @@ repos:
args: ["-w", "-i", "4", "-ci"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude: ^testing/Baseline
- id: end-of-file-fixer
exclude: ^testing/Baseline|examples/.*Baseline.*

- repo: https://github.com/psf/black
rev: 23.1a1
rev: 23.7.0
hooks:
- id: black

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.10.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]

- repo: https://github.com/pycqa/flake8
rev: 5.0.4 # 6.0.0 requires Python 3.8
rev: 6.1.0 # 6.0.0 requires Python 3.8
hooks:
- id: flake8

Expand Down
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.1-2 | 2023-08-09 15:20:16 +0200

* Bump pre-commit hooks. (Benjamin Bannier, Corelight)

1.1 | 2023-07-05 09:52:44 -0700

* Release 1.1.
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
..
.. Version number is filled in automatically.

.. |version| replace:: 1.1
.. |version| replace:: 1.1-2

==================================================
BTest - A Generic Driver for Powerful System Tests
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1
1.1-2
2 changes: 1 addition & 1 deletion btest
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ else:
import multiprocessing.managers as mp_managers
import multiprocessing.sharedctypes as mp_sharedctypes

VERSION = "1.1" # Automatically filled in.
VERSION = "1.1-2" # Automatically filled in.

Name = "btest"
Config = None
Expand Down
42 changes: 21 additions & 21 deletions btest-diff
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ if [ "$TEST_DIAGNOSTICS" = "" ]; then
fi

if [ "$#" -lt 1 ]; then
echo "btest-diff: wrong number of arguments" >$TEST_DIAGNOSTICS
echo "btest-diff: wrong number of arguments" >"$TEST_DIAGNOSTICS"
exit 1
fi

Expand All @@ -143,13 +143,13 @@ canon=$(echo "$input" | sed 's#/#.#g')
shift

if [ ! -f "$input" ]; then
echo "btest-diff: input $input does not exist." >$TEST_DIAGNOSTICS
echo "btest-diff: input $input does not exist." >"$TEST_DIAGNOSTICS"
exit 1
fi

tmpfiles=""
delete_tmps() {
# shellcheck disable=SC2086
# shellcheck disable=SC2086,SC2317
rm -f $tmpfiles 2>/dev/null
}

Expand All @@ -163,20 +163,20 @@ done

result=2

rm -f $TEST_DIAGNOSTICS 2>/dev/null
rm -f "$TEST_DIAGNOSTICS" 2>/dev/null

echo "== File ===============================" >>$TEST_DIAGNOSTICS
echo "== File ===============================" >>"$TEST_DIAGNOSTICS"

if [ -z "$baseline" ]; then
cat "$input" >>$TEST_DIAGNOSTICS
cat "$input" >>"$TEST_DIAGNOSTICS"
elif [ -n "$TEST_DIFF_BRIEF" ]; then
echo "<Content not shown>" >>$TEST_DIAGNOSTICS
echo "<Content not shown>" >>"$TEST_DIAGNOSTICS"
else
if [ "$(wc -l "$input" | awk '{print $1}')" -le "$MAX_LINES" ]; then
cat "$input" >>$TEST_DIAGNOSTICS
cat "$input" >>"$TEST_DIAGNOSTICS"
else
head -n "$MAX_LINES" "$input" >>$TEST_DIAGNOSTICS
echo "[... File too long, truncated ...]" >>$TEST_DIAGNOSTICS
head -n "$MAX_LINES" "$input" >>"$TEST_DIAGNOSTICS"
echo "[... File too long, truncated ...]" >>"$TEST_DIAGNOSTICS"
fi
fi

Expand All @@ -194,8 +194,8 @@ error=0
# shellcheck disable=SC2094
eval "$TEST_DIFF_CANONIFIER" "$input" <"$input" >"$canon_output"
if [ $? -ne 0 ]; then
echo "== Error ==============================" >>$TEST_DIAGNOSTICS
echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$input'" >>$TEST_DIAGNOSTICS
echo "== Error ==============================" >>"$TEST_DIAGNOSTICS"
echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$input'" >>"$TEST_DIAGNOSTICS"
error=1
result=1
fi
Expand All @@ -213,32 +213,32 @@ if [ -n "$baseline" ]; then
# shellcheck disable=SC2094
eval "$TEST_DIFF_CANONIFIER" "$baseline" <"$baseline" >"$canon_baseline"
if [ $? -ne 0 ]; then
echo "== Error ==============================" >>$TEST_DIAGNOSTICS
echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$baseline'" >>$TEST_DIAGNOSTICS
echo "== Error ==============================" >>"$TEST_DIAGNOSTICS"
echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$baseline'" >>"$TEST_DIAGNOSTICS"
error=1
result=1
fi
fi

if [ $error -eq 0 ]; then
echo "== Diff ===============================" >>$TEST_DIAGNOSTICS
echo "== Diff ===============================" >>"$TEST_DIAGNOSTICS"
if is_binary_mode; then
diff -s "$@" "$canon_baseline" "$canon_output" >>$TEST_DIAGNOSTICS
diff -s "$@" "$canon_baseline" "$canon_output" >>"$TEST_DIAGNOSTICS"
else
# We'd use --strip-trailing-cr in the following, but it's not guaranteed.
diff -au "$@" \
<(sed 's/\r$//' "$canon_baseline") \
<(sed 's/\r$//' "$canon_output") >>$TEST_DIAGNOSTICS
<(sed 's/\r$//' "$canon_output") >>"$TEST_DIAGNOSTICS"
fi
result=$?
fi
elif [ "$TEST_MODE" = "TEST" ]; then
echo "== Error ==============================" >>$TEST_DIAGNOSTICS
echo "test-diff: no baseline found." >>$TEST_DIAGNOSTICS
echo "== Error ==============================" >>"$TEST_DIAGNOSTICS"
echo "test-diff: no baseline found." >>"$TEST_DIAGNOSTICS"
result=100
fi

echo "=======================================" >>$TEST_DIAGNOSTICS
echo "=======================================" >>"$TEST_DIAGNOSTICS"

if [ "$TEST_MODE" = "TEST" ]; then
exit $result
Expand Down Expand Up @@ -278,5 +278,5 @@ elif [ "$TEST_MODE" = "UPDATE" ]; then
exit 0
fi

echo "test-diff: unknown test mode $TEST_MODE" >$TEST_DIAGNOSTICS
echo "test-diff: unknown test mode $TEST_MODE" >"$TEST_DIAGNOSTICS"
exit 1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

setup(
name="btest",
version="1.1", # Filled in automatically.
version="1.1.dev2", # Filled in automatically.
description="A powerful system testing framework",
long_description="See https://github.com/zeek/btest",
author="The Zeek Team",
Expand Down
2 changes: 1 addition & 1 deletion testing/Scripts/convert-path-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ for i in "${PARTS[@]}"; do
new_list+=":"
done

echo ${new_list%?}
echo "${new_list%?}"

0 comments on commit 6339085

Please sign in to comment.