File: run-unit-test

package info (click to toggle)
bsdiff 4.3-23
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 220 kB
  • sloc: ansic: 1,674; makefile: 43; sh: 15
file content (25 lines) | stat: -rwxr-xr-x 700 bytes parent folder | download
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
#!/bin/bash
set -e

# generate a diff between 2 binaries
/usr/bin/bsdiff /usr/bin/bspatch \
        /usr/bin/bsdiff \
        ${AUTOPKGTEST_TMP}/bspatch_to_bsdiff.patch

# apply the patch to generate a new binary
/usr/bin/bspatch /usr/bin/bspatch \
        ${AUTOPKGTEST_TMP}/patched_bspatch \
        ${AUTOPKGTEST_TMP}/bspatch_to_bsdiff.patch

# calculate the checksums
EXPECTED_CHECKSUM=$(sha256sum < /usr/bin/bsdiff)
PATCHED_CHECKSUM=$(sha256sum < ${AUTOPKGTEST_TMP}/patched_bspatch)

# compare output with expected output
if [[ "${EXPECTED_CHECKSUM}" = "${PATCHED_CHECKSUM}" ]]; then
    echo "PASS"
    exit 0
fi

echo "FAIL unable to bspatch a binary using a patch created with bsdiff"
exit 1