File: check_replay_against_blktrace.sh

package info (click to toggle)
blkreplay 1.0-3.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 25,672 kB
  • sloc: sh: 3,175; ansic: 2,057; makefile: 23
file content (68 lines) | stat: -rwxr-xr-x 2,218 bytes parent folder | download | duplicates (2)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
# Copyright 2010-2012 Thomas Schoebel-Theuer /  1&1 Internet AG
#
# Email: tst@1und1.de
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

#####################################################################

# Plausibilty checking for the blkreplay system:
#
# Check coincidence between a .replay.gz file and a concurrently
# recorded blktrace set of files (running upon the same device).

if (( $# != 2 )); then
    echo "usage: $0 file1.replay.gz prefix_file2[.blktrace.*]"
    exit -1
fi

replay="$1"
blktrace="$2"

if ! [ -r "$replay" ]; then
    echo "Input file '$replay' does not exist"
    exit -1
fi
if ! [[ "$replay:" =~ ".replay.gz:" ]]; then
    echo "Input file '$replay' is no .replay.gz file"
    exit -1
fi
if ! [ -f "$blktrace.blktrace.0" ]; then
    echo "Blocktrace file '$blktrace.blktrace.0' does not exist"
    exit -1
fi

# check some preconditions
script_dir="$(cd "$(dirname "$(which "$0")")"; pwd)"
noecho=1
source "$script_dir/modules/lib.sh" || exit $?

check_list="mkfifo grep sed cut gunzip diff blkparse"
check_installed "$check_list"

######################################################################

tmp="${TMPDIR:-/tmp}/check.$$"
mkdir -p $tmp || exit $?
mkfifo $tmp/replay $tmp/blktrace || exit $?

zgrep ";" "$replay" | cut -d";" -f 2-4 | sort -n -s > $tmp/replay &

$script_dir/conv_blktrace_to_load.sh "$blktrace" - 2>/dev/null | grep ";" | cut -d";" -f 2-4 | sort -n -s > $tmp/blktrace &

diff -y -w --suppress-common-lines --minimal --speed-large-files $tmp/replay $tmp/blktrace

rm -rf $tmp