From bd3f8d6be818acc711056372870da2c915a9fd36 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 26 Mar 2014 09:35:07 -0700 Subject: [PATCH 91/91] tests: Use msdos-overlap to setup t0283 xxd isn't present in minimal build systems, as it is part of vim. Change to using a simple python script to mangle the msdos disklabel for the test. * tests/msdos-overlap.py: New file * tests/t0283-overlap-partitions.sh: Use msdos-overlap.py --- tests/msdos-overlap.py | 25 ++++++++++++++++++++++++ tests/t0283-overlap-partitions.sh | 40 +++------------------------------------ 2 files changed, 28 insertions(+), 37 deletions(-) create mode 100755 tests/msdos-overlap.py diff --git a/tests/msdos-overlap.py b/tests/msdos-overlap.py new file mode 100755 index 0000000..5bddfb0 --- /dev/null +++ b/tests/msdos-overlap.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +""" + Write an overlapping partition to a msdos disk + + Call with disk image/device to mangle +""" +import sys + +BAD_ENTRY = (0x72, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x10, 0x83, 0x03, 0x20, 0x4f, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x50, 0x83, 0x00, 0x0a, 0x7a, 0xff, 0x27, + 0x00, 0x00, 0x0a, 0x15, 0x00, 0x00, 0x00, 0x00 ) +OFFSET = 0x1b8 + +if len(sys.argv) < 2: + print "%s: " + sys.exit(1) + +data = "".join(chr(c) for c in BAD_ENTRY) +with open(sys.argv[1], "rb+") as f: + f.seek(OFFSET, 0) + f.write(data) + +sys.exit(0) diff --git a/tests/t0283-overlap-partitions.sh b/tests/t0283-overlap-partitions.sh index c7ae52a..221332d 100644 --- a/tests/t0283-overlap-partitions.sh +++ b/tests/t0283-overlap-partitions.sh @@ -21,43 +21,9 @@ require_512_byte_sector_size_ dev=loop-file -truncate -s 10m $dev || fail=1 - -# write damaged label -xxd -r - $dev < out 2>&1 || fail=1 -- 1.9.0