From 78ba2fe96dc7f39e585c508bfbc3549cc50aefff Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 11 Jun 2014 11:00:39 -0700 Subject: [PATCH 125/125] Fix python test scripts for distribution make distcheck was failing because these scripts were not being included. Make them both executable and and add the path to the tests that use them. They also need to be included in the distribution so update Makefile.am * tests/Makefile.am: Add python test scripts * tests/gpt-header-move.py: rename to gpt-header-move and make it executable * tests/msdos-overlap.py: rename to overlap.py * tests/t0282-gpt-move-backup.sh: add path to scripts and use new name * tests/t0283-overlap-partitions.sh: same --- tests/Makefile.am | 3 ++- tests/gpt-header-move | 41 +++++++++++++++++++++++++++++++++++++++ tests/gpt-header-move.py | 39 ------------------------------------- tests/msdos-overlap | 25 ++++++++++++++++++++++++ tests/msdos-overlap.py | 25 ------------------------ tests/t0282-gpt-move-backup.sh | 4 ++-- tests/t0283-overlap-partitions.sh | 4 ++-- 7 files changed, 72 insertions(+), 69 deletions(-) create mode 100755 tests/gpt-header-move delete mode 100644 tests/gpt-header-move.py create mode 100755 tests/msdos-overlap delete mode 100755 tests/msdos-overlap.py diff --git a/tests/Makefile.am b/tests/Makefile.am index 26226cf..0b5b1b6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -85,7 +85,8 @@ TESTS = \ EXTRA_DIST = \ $(TESTS) t-local.sh t-lvm.sh \ - init.cfg init.sh t-lib-helpers.sh gpt-header-munge + init.cfg init.sh t-lib-helpers.sh gpt-header-munge \ + gpt-header-move msdos-overlap check_PROGRAMS = print-align print-max dup-clobber duplicate fs-resize fs_resize_LDADD = \ diff --git a/tests/gpt-header-move b/tests/gpt-header-move new file mode 100755 index 0000000..05cdc65 --- /dev/null +++ b/tests/gpt-header-move @@ -0,0 +1,41 @@ +#!/usr/bin/python + +# open img file, subtract 33 from altlba address, and move the last 33 sectors +# back by 33 sectors + +from struct import * +from zipfile import crc32 +import array +import sys +file = open(sys.argv[1],'rb+') +file.seek(512) +gptheader = file.read(512) +altlba = unpack_from('" + 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/msdos-overlap.py b/tests/msdos-overlap.py deleted file mode 100755 index 5bddfb0..0000000 --- a/tests/msdos-overlap.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/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/t0282-gpt-move-backup.sh b/tests/t0282-gpt-move-backup.sh index b827672..c197279 100644 --- a/tests/t0282-gpt-move-backup.sh +++ b/tests/t0282-gpt-move-backup.sh @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. "${srcdir=.}/init.sh"; path_prepend_ ../parted +. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir require_512_byte_sector_size_ dev=loop-file @@ -40,7 +40,7 @@ printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \ compare exp out || fail=1 # move the backup -python ../gpt-header-move.py $dev || fail=1 +gpt-header-move $dev || fail=1 # printing must warn, but not fix in script mode parted -s $dev print > out 2>&1 || fail=1 diff --git a/tests/t0283-overlap-partitions.sh b/tests/t0283-overlap-partitions.sh index f9a3aff..7928c94 100644 --- a/tests/t0283-overlap-partitions.sh +++ b/tests/t0283-overlap-partitions.sh @@ -17,13 +17,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. "${srcdir=.}/init.sh"; path_prepend_ ../parted +. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir require_512_byte_sector_size_ dev=loop-file truncate -s 10m $dev || framework_failure parted -s $dev mklabel msdos || framework_failure -python ../msdos-overlap.py $dev || framework_failure +msdos-overlap $dev || framework_failure # print the empty table parted ---pretend-input-tty $dev < out 2>&1 || fail=1 -- 1.9.3