forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcheck.sh
executable file
·35 lines (30 loc) · 1.07 KB
/
check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
#
# Copyright 2022 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the chromium source repository LICENSE file.
#
# Given a zlib_bench executable and some data files, run zlib_bench --check
# over those data files, for all zlib types (gzip|zlib|raw) and compression
# levels 1..9 for each type. Example:
#
# check.sh ./out/Release/zlib_bench [--check-binary] ~/snappy/testdata/*
#
# The --check-binary option modifies --check output: the compressed data is
# also written to the program output.
ZLIB_BENCH="$1" && shift
CHECK_TYPE="--check"
if [[ "${1}" == "--check-binary" ]]; then
CHECK_TYPE="$1" && shift # output compressed data too
fi
DATA_FILES="$*"
echo ${ZLIB_BENCH} | grep -E "/(zlib_bench|a.out)$" > /dev/null
if [[ $? != 0 ]] || [[ -z "${DATA_FILES}" ]]; then
echo "usage: check.sh zlib_bench [--check-binary] files ..." >&2
exit 1;
fi
for type in gzip zlib raw; do
for level in $(seq 1 9); do
${ZLIB_BENCH} $type --compression $level ${CHECK_TYPE} ${DATA_FILES}
done
done