summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:16:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:16:34 +0000
commita398d2c2b5fd6ab0545d8bb019f9a970b2309404 (patch)
tree272fc7ab226258d7ceddee12c8c682c8e711c2b0 /tests
parentInitial commit. (diff)
downloadparted-a398d2c2b5fd6ab0545d8bb019f9a970b2309404.tar.xz
parted-a398d2c2b5fd6ab0545d8bb019f9a970b2309404.zip
Adding upstream version 3.6.upstream/3.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/Makefile.am150
-rw-r--r--tests/Makefile.in2518
-rw-r--r--tests/dup-clobber.c103
-rw-r--r--tests/duplicate.c159
-rw-r--r--tests/fs-resize.c75
-rwxr-xr-xtests/gpt-attrs72
-rwxr-xr-xtests/gpt-header-move42
-rwxr-xr-xtests/gpt-header-munge285
-rwxr-xr-xtests/help-version.sh282
-rw-r--r--tests/init.cfg132
-rw-r--r--tests/init.sh589
-rwxr-xr-xtests/msdos-overlap24
-rw-r--r--tests/print-align.c50
-rw-r--r--tests/print-flags.c58
-rw-r--r--tests/print-max.c45
-rw-r--r--tests/t-lib-helpers.sh430
-rw-r--r--tests/t-local.sh196
-rw-r--r--tests/t-lvm.sh82
-rwxr-xr-xtests/t0000-basic.sh78
-rwxr-xr-xtests/t0001-tiny.sh47
-rwxr-xr-xtests/t0010-script-no-ctrl-chars.sh39
-rwxr-xr-xtests/t0100-print.sh60
-rwxr-xr-xtests/t0101-print-empty.sh49
-rwxr-xr-xtests/t0200-gpt.sh49
-rwxr-xr-xtests/t0201-gpt.sh39
-rwxr-xr-xtests/t0202-gpt-pmbr.sh49
-rw-r--r--tests/t0203-gpt-create-on-min-sized-device.sh46
-rwxr-xr-xtests/t0203-gpt-shortened-device-primary-valid.sh49
-rw-r--r--tests/t0203-gpt-tiny-device-abort.sh42
-rw-r--r--tests/t0205-gpt-list-clobbers-pmbr.sh51
-rwxr-xr-xtests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh48
-rw-r--r--tests/t0207-IEC-binary-notation.sh71
-rw-r--r--tests/t0208-mkpart-end-in-IEC.sh61
-rwxr-xr-xtests/t0209-gpt-pmbr_boot.sh38
-rwxr-xr-xtests/t0210-gpt-resized-partition-entry-array.sh44
-rw-r--r--tests/t0211-gpt-rewrite-header.sh82
-rw-r--r--tests/t0212-gpt-many-partitions.sh56
-rwxr-xr-xtests/t0213-mkpart-start-negative.sh48
-rw-r--r--tests/t0215-gpt-attrs.sh46
-rwxr-xr-xtests/t0220-gpt-msftres.sh80
-rwxr-xr-xtests/t0250-gpt.sh42
-rwxr-xr-xtests/t0251-gpt-unicode.sh42
-rwxr-xr-xtests/t0280-gpt-corrupt.sh96
-rw-r--r--tests/t0281-gpt-grow.sh100
-rw-r--r--tests/t0282-gpt-move-backup.sh100
-rw-r--r--tests/t0283-overlap-partitions.sh105
-rwxr-xr-xtests/t0290-gpt-name.sh41
-rwxr-xr-xtests/t0300-dos-on-gpt.sh36
-rwxr-xr-xtests/t0301-overwrite-gpt-pmbr.sh44
-rw-r--r--tests/t0350-mac-PT-increases-sector-size.sh49
-rw-r--r--tests/t0400-loop-clobber-infloop.sh40
-rw-r--r--tests/t0500-dup-clobber.sh26
-rw-r--r--tests/t0501-duplicate.sh30
-rwxr-xr-xtests/t0800-json-gpt.sh99
-rwxr-xr-xtests/t0801-json-msdos.sh89
-rwxr-xr-xtests/t0900-type-gpt.sh71
-rwxr-xr-xtests/t0901-type-gpt-invalid.sh35
-rwxr-xr-xtests/t0910-type-dos.sh69
-rwxr-xr-xtests/t0911-type-dos-invalid.sh35
-rwxr-xr-xtests/t1100-busy-label.sh80
-rwxr-xr-xtests/t1101-busy-partition.sh70
-rw-r--r--tests/t1102-loop-label.sh88
-rw-r--r--tests/t1104-remove-and-add-partition.sh50
-rwxr-xr-xtests/t1700-probe-fs.sh73
-rw-r--r--tests/t1701-rescue-fs.sh53
-rwxr-xr-xtests/t2200-dos-label-recog.sh52
-rwxr-xr-xtests/t2201-pc98-label-recog.sh41
-rwxr-xr-xtests/t2300-dos-label-extended-bootcode.sh59
-rw-r--r--tests/t2310-dos-extended-2-sector-min-offset.sh54
-rw-r--r--tests/t2320-dos-extended-noclobber.sh49
-rw-r--r--tests/t2400-dos-hfs-partition-type.sh40
-rw-r--r--tests/t2410-dos-udf-partition-type.sh38
-rwxr-xr-xtests/t2500-probe-corrupt-hfs.sh41
-rwxr-xr-xtests/t3000-resize-fs.sh156
-rwxr-xr-xtests/t3200-resize-partition.sh127
-rwxr-xr-xtests/t3200-type-change.sh73
-rwxr-xr-xtests/t3210-gpt-type-change.sh107
-rwxr-xr-xtests/t3300-palo-prep.sh44
-rw-r--r--tests/t3310-flags.sh134
-rwxr-xr-xtests/t3400-whole-disk-FAT-partition.sh32
-rwxr-xr-xtests/t4000-sun-raid-type.sh59
-rwxr-xr-xtests/t4001-sun-vtoc.sh52
-rwxr-xr-xtests/t4100-dvh-partition-limits.sh166
-rwxr-xr-xtests/t4100-msdos-partition-limits.sh152
-rwxr-xr-xtests/t4100-msdos-starting-sector.sh72
-rwxr-xr-xtests/t4200-partprobe.sh51
-rwxr-xr-xtests/t4300-nilfs2-tiny.sh32
-rwxr-xr-xtests/t4301-nilfs2-badsb2.sh43
-rwxr-xr-xtests/t4302-nilfs2-lessbadsb2.sh47
-rwxr-xr-xtests/t5000-tags.sh81
-rwxr-xr-xtests/t6000-dm.sh98
-rw-r--r--tests/t6001-psep.sh78
-rw-r--r--tests/t6002-dm-busy.sh92
-rw-r--r--tests/t6003-dm-hide.sh67
-rwxr-xr-xtests/t6004-dm-many-partitions.sh61
-rwxr-xr-xtests/t6005-dm-uuid.sh62
-rw-r--r--tests/t6006-dm-512b-sectors.sh70
-rwxr-xr-xtests/t6100-mdraid-partitions.sh69
-rwxr-xr-xtests/t7000-scripting.sh78
-rwxr-xr-xtests/t8000-loop.sh44
-rwxr-xr-xtests/t8001-loop-blkpg.sh62
-rwxr-xr-xtests/t9010-big-sector.sh41
-rwxr-xr-xtests/t9020-alignment.sh43
-rwxr-xr-xtests/t9021-maxima.sh75
-rw-r--r--tests/t9022-one-unit-snap.sh42
-rw-r--r--tests/t9023-value-lt-one.sh32
-rw-r--r--tests/t9024-msdos-1s-partition.sh36
-rw-r--r--tests/t9025-gpt-1s-partition.sh36
-rw-r--r--tests/t9030-align-check.sh56
-rw-r--r--tests/t9040-many-partitions.sh67
-rw-r--r--tests/t9041-undetected-in-use-16th-partition.sh99
-rw-r--r--tests/t9042-dos-partition-limit.sh74
-rwxr-xr-xtests/t9050-partition-table-types.sh57
-rwxr-xr-xtests/t9060-gpt-grow-script-fix.sh100
114 files changed, 11368 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..fa27b44
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,150 @@
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+
+TESTS = \
+ help-version.sh \
+ t0000-basic.sh \
+ t0001-tiny.sh \
+ t0010-script-no-ctrl-chars.sh \
+ t0100-print.sh \
+ t0101-print-empty.sh \
+ t0200-gpt.sh \
+ t0201-gpt.sh \
+ t0202-gpt-pmbr.sh \
+ t0203-gpt-tiny-device-abort.sh \
+ t0203-gpt-shortened-device-primary-valid.sh \
+ t0203-gpt-create-on-min-sized-device.sh \
+ t0205-gpt-list-clobbers-pmbr.sh \
+ t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh \
+ t0207-IEC-binary-notation.sh \
+ t0208-mkpart-end-in-IEC.sh \
+ t0209-gpt-pmbr_boot.sh \
+ t0210-gpt-resized-partition-entry-array.sh \
+ t0211-gpt-rewrite-header.sh \
+ t0212-gpt-many-partitions.sh \
+ t0213-mkpart-start-negative.sh \
+ t0215-gpt-attrs.sh \
+ t0220-gpt-msftres.sh \
+ t0250-gpt.sh \
+ t0251-gpt-unicode.sh \
+ t0280-gpt-corrupt.sh \
+ t0281-gpt-grow.sh \
+ t0282-gpt-move-backup.sh \
+ t0283-overlap-partitions.sh \
+ t0290-gpt-name.sh \
+ t0300-dos-on-gpt.sh \
+ t0301-overwrite-gpt-pmbr.sh \
+ t0350-mac-PT-increases-sector-size.sh \
+ t0400-loop-clobber-infloop.sh \
+ t0500-dup-clobber.sh \
+ t0501-duplicate.sh \
+ t0800-json-gpt.sh \
+ t0801-json-msdos.sh \
+ t0900-type-gpt.sh \
+ t0901-type-gpt-invalid.sh \
+ t0910-type-dos.sh \
+ t0911-type-dos-invalid.sh \
+ t1100-busy-label.sh \
+ t1101-busy-partition.sh \
+ t1102-loop-label.sh \
+ t1104-remove-and-add-partition.sh \
+ t1700-probe-fs.sh \
+ t1701-rescue-fs.sh \
+ t2200-dos-label-recog.sh \
+ t2201-pc98-label-recog.sh \
+ t2300-dos-label-extended-bootcode.sh \
+ t2310-dos-extended-2-sector-min-offset.sh \
+ t2320-dos-extended-noclobber.sh \
+ t2400-dos-hfs-partition-type.sh \
+ t2410-dos-udf-partition-type.sh \
+ t2500-probe-corrupt-hfs.sh \
+ t3000-resize-fs.sh \
+ t3200-resize-partition.sh \
+ t3200-type-change.sh \
+ t3210-gpt-type-change.sh \
+ t3300-palo-prep.sh \
+ t3310-flags.sh \
+ t3400-whole-disk-FAT-partition.sh \
+ t4000-sun-raid-type.sh \
+ t4001-sun-vtoc.sh \
+ t4100-msdos-partition-limits.sh \
+ t4100-dvh-partition-limits.sh \
+ t4100-msdos-starting-sector.sh \
+ t4200-partprobe.sh \
+ t4300-nilfs2-tiny.sh \
+ t4301-nilfs2-badsb2.sh \
+ t4302-nilfs2-lessbadsb2.sh \
+ t5000-tags.sh \
+ t6000-dm.sh \
+ t6001-psep.sh \
+ t6002-dm-busy.sh \
+ t6003-dm-hide.sh \
+ t6004-dm-many-partitions.sh \
+ t6005-dm-uuid.sh \
+ t6006-dm-512b-sectors.sh \
+ t6100-mdraid-partitions.sh \
+ t7000-scripting.sh \
+ t8000-loop.sh \
+ t8001-loop-blkpg.sh \
+ t9010-big-sector.sh \
+ t9020-alignment.sh \
+ t9021-maxima.sh \
+ t9022-one-unit-snap.sh \
+ t9023-value-lt-one.sh \
+ t9024-msdos-1s-partition.sh \
+ t9025-gpt-1s-partition.sh \
+ t9030-align-check.sh \
+ t9040-many-partitions.sh \
+ t9041-undetected-in-use-16th-partition.sh \
+ t9042-dos-partition-limit.sh \
+ t9050-partition-table-types.sh \
+ t9060-gpt-grow-script-fix.sh
+
+EXTRA_DIST = \
+ $(TESTS) t-local.sh t-lvm.sh \
+ init.cfg init.sh t-lib-helpers.sh gpt-header-munge \
+ gpt-header-move msdos-overlap gpt-attrs
+
+check_PROGRAMS = print-align print-flags print-max dup-clobber duplicate \
+ fs-resize
+fs_resize_LDADD = \
+ $(top_builddir)/libparted/fs/libparted-fs-resize.la \
+ $(top_builddir)/libparted/libparted.la
+
+LDADD = \
+ $(top_builddir)/libparted/libparted.la
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/lib \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+
+parted_dir = $(abs_top_builddir)/parted
+pp_dir = $(abs_top_builddir)/partprobe
+sep = $(PATH_SEPARATOR)
+
+# Note that the first lines are statements. They ensure that environment
+# variables that can perturb tests are unset or set to expected values.
+# The rest are envvar settings that propagate build-related Makefile
+# variables to test scripts.
+TESTS_ENVIRONMENT = \
+ tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
+ TMPDIR=$$tmp__; export TMPDIR; \
+ export \
+ abs_top_builddir='$(abs_top_builddir)' \
+ abs_top_srcdir='$(abs_top_srcdir)' \
+ abs_srcdir='$(abs_srcdir)' \
+ built_programs=parted \
+ srcdir='$(srcdir)' \
+ top_srcdir='$(top_srcdir)' \
+ AWK='$(AWK)' \
+ PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)' \
+ PACKAGE_VERSION=$(PACKAGE_VERSION) \
+ CONFIG_HEADER='$(abs_top_builddir)/lib/config.h' \
+ ENABLE_DEVICE_MAPPER=$(ENABLE_DEVICE_MAPPER) \
+ PARTED_TEST_NAME=`basename '$(abs_srcdir)'`,`echo $$tst|sed 's,^\./,,;s,/,-,g'`\
+ PATH='$(abs_top_builddir)/parted$(PATH_SEPARATOR)'"$$PATH" \
+ VERSION=$(VERSION) \
+ ; 9>&2
+
+VERBOSE = yes
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000..d8546d2
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,2518 @@
+# Makefile.in generated by automake 1.16.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2021 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = print-align$(EXEEXT) print-flags$(EXEEXT) \
+ print-max$(EXEEXT) dup-clobber$(EXEEXT) duplicate$(EXEEXT) \
+ fs-resize$(EXEEXT)
+subdir = tests
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
+ $(top_srcdir)/m4/__inline.m4 \
+ $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
+ $(top_srcdir)/m4/arpa_inet_h.m4 $(top_srcdir)/m4/assert.m4 \
+ $(top_srcdir)/m4/assert_h.m4 $(top_srcdir)/m4/btowc.m4 \
+ $(top_srcdir)/m4/build-to-host.m4 \
+ $(top_srcdir)/m4/builtin-expect.m4 $(top_srcdir)/m4/c-bool.m4 \
+ $(top_srcdir)/m4/calloc.m4 $(top_srcdir)/m4/canonicalize.m4 \
+ $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \
+ $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/config-h.m4 \
+ $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/ctype_h.m4 \
+ $(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup2.m4 \
+ $(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
+ $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
+ $(top_srcdir)/m4/error_h.m4 $(top_srcdir)/m4/extensions.m4 \
+ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
+ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \
+ $(top_srcdir)/m4/fdopen.m4 $(top_srcdir)/m4/flexmember.m4 \
+ $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/free.m4 \
+ $(top_srcdir)/m4/fstat.m4 $(top_srcdir)/m4/fsync.m4 \
+ $(top_srcdir)/m4/ftruncate.m4 $(top_srcdir)/m4/getcwd.m4 \
+ $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \
+ $(top_srcdir)/m4/getpagesize.m4 \
+ $(top_srcdir)/m4/getprogname.m4 $(top_srcdir)/m4/getrandom.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gettimeofday.m4 \
+ $(top_srcdir)/m4/gnulib-common.m4 \
+ $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_pton.m4 \
+ $(top_srcdir)/m4/intl-thread-locale.m4 \
+ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/inttypes.m4 \
+ $(top_srcdir)/m4/ioctl.m4 $(top_srcdir)/m4/isblank.m4 \
+ $(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \
+ $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ignore.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/localcharset.m4 \
+ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \
+ $(top_srcdir)/m4/locale-tr.m4 $(top_srcdir)/m4/locale-zh.m4 \
+ $(top_srcdir)/m4/locale_h.m4 $(top_srcdir)/m4/localeconv.m4 \
+ $(top_srcdir)/m4/localename.m4 $(top_srcdir)/m4/lock.m4 \
+ $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/lstat.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/malloca.m4 \
+ $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/mbrtowc.m4 \
+ $(top_srcdir)/m4/mbsinit.m4 $(top_srcdir)/m4/mbstate_t.m4 \
+ $(top_srcdir)/m4/mbtowc.m4 $(top_srcdir)/m4/memchr.m4 \
+ $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/minmax.m4 \
+ $(top_srcdir)/m4/mkdir.m4 $(top_srcdir)/m4/mkstemp.m4 \
+ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \
+ $(top_srcdir)/m4/msvc-inval.m4 \
+ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
+ $(top_srcdir)/m4/musl.m4 $(top_srcdir)/m4/nanosleep.m4 \
+ $(top_srcdir)/m4/netinet_in_h.m4 \
+ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/o-direct.m4 \
+ $(top_srcdir)/m4/off_t.m4 $(top_srcdir)/m4/open-cloexec.m4 \
+ $(top_srcdir)/m4/open-slash.m4 $(top_srcdir)/m4/open.m4 \
+ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/perror.m4 \
+ $(top_srcdir)/m4/pipe.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/priv-set.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/pselect.m4 $(top_srcdir)/m4/pthread-thread.m4 \
+ $(top_srcdir)/m4/pthread_h.m4 \
+ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \
+ $(top_srcdir)/m4/pthread_sigmask.m4 $(top_srcdir)/m4/putenv.m4 \
+ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
+ $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/rawmemchr.m4 \
+ $(top_srcdir)/m4/read.m4 $(top_srcdir)/m4/readlink.m4 \
+ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/reallocarray.m4 \
+ $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/rpmatch.m4 \
+ $(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/sched_h.m4 \
+ $(top_srcdir)/m4/sched_yield.m4 $(top_srcdir)/m4/select.m4 \
+ $(top_srcdir)/m4/semaphore.m4 $(top_srcdir)/m4/setenv.m4 \
+ $(top_srcdir)/m4/setlocale.m4 \
+ $(top_srcdir)/m4/setlocale_null.m4 \
+ $(top_srcdir)/m4/signal_h.m4 \
+ $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/sleep.m4 \
+ $(top_srcdir)/m4/socketlib.m4 $(top_srcdir)/m4/sockets.m4 \
+ $(top_srcdir)/m4/socklen.m4 $(top_srcdir)/m4/sockpfaf.m4 \
+ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-time.m4 \
+ $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdalign.m4 \
+ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stddef_h.m4 \
+ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio_h.m4 \
+ $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strdup.m4 \
+ $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/strerror_r.m4 \
+ $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strtoll.m4 \
+ $(top_srcdir)/m4/strtoull.m4 $(top_srcdir)/m4/symlink.m4 \
+ $(top_srcdir)/m4/sys_ioctl_h.m4 \
+ $(top_srcdir)/m4/sys_random_h.m4 \
+ $(top_srcdir)/m4/sys_select_h.m4 \
+ $(top_srcdir)/m4/sys_socket_h.m4 \
+ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
+ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/sys_uio_h.m4 \
+ $(top_srcdir)/m4/tempname.m4 $(top_srcdir)/m4/thread.m4 \
+ $(top_srcdir)/m4/threadlib.m4 $(top_srcdir)/m4/time.m4 \
+ $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/unistd_h.m4 \
+ $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/unlinkdir.m4 \
+ $(top_srcdir)/m4/usleep.m4 $(top_srcdir)/m4/version-etc.m4 \
+ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/warn-on-use.m4 \
+ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_h.m4 \
+ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcrtomb.m4 \
+ $(top_srcdir)/m4/wctob.m4 $(top_srcdir)/m4/wctomb.m4 \
+ $(top_srcdir)/m4/wctype_h.m4 $(top_srcdir)/m4/wint_t.m4 \
+ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrtol.m4 \
+ $(top_srcdir)/m4/yield.m4 $(top_srcdir)/m4/zzgnulib.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/lib/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+dup_clobber_SOURCES = dup-clobber.c
+dup_clobber_OBJECTS = dup-clobber.$(OBJEXT)
+dup_clobber_LDADD = $(LDADD)
+dup_clobber_DEPENDENCIES = $(top_builddir)/libparted/libparted.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+duplicate_SOURCES = duplicate.c
+duplicate_OBJECTS = duplicate.$(OBJEXT)
+duplicate_LDADD = $(LDADD)
+duplicate_DEPENDENCIES = $(top_builddir)/libparted/libparted.la
+fs_resize_SOURCES = fs-resize.c
+fs_resize_OBJECTS = fs-resize.$(OBJEXT)
+fs_resize_DEPENDENCIES = \
+ $(top_builddir)/libparted/fs/libparted-fs-resize.la \
+ $(top_builddir)/libparted/libparted.la
+print_align_SOURCES = print-align.c
+print_align_OBJECTS = print-align.$(OBJEXT)
+print_align_LDADD = $(LDADD)
+print_align_DEPENDENCIES = $(top_builddir)/libparted/libparted.la
+print_flags_SOURCES = print-flags.c
+print_flags_OBJECTS = print-flags.$(OBJEXT)
+print_flags_LDADD = $(LDADD)
+print_flags_DEPENDENCIES = $(top_builddir)/libparted/libparted.la
+print_max_SOURCES = print-max.c
+print_max_OBJECTS = print-max.$(OBJEXT)
+print_max_LDADD = $(LDADD)
+print_max_DEPENDENCIES = $(top_builddir)/libparted/libparted.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/lib
+depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/dup-clobber.Po \
+ ./$(DEPDIR)/duplicate.Po ./$(DEPDIR)/fs-resize.Po \
+ ./$(DEPDIR)/print-align.Po ./$(DEPDIR)/print-flags.Po \
+ ./$(DEPDIR)/print-max.Po
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = dup-clobber.c duplicate.c fs-resize.c print-align.c \
+ print-flags.c print-max.c
+DIST_SOURCES = dup-clobber.c duplicate.c fs-resize.c print-align.c \
+ print-flags.c print-max.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)'
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.sh.log=.log)
+SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver
+SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+ $(top_srcdir)/build-aux/depcomp \
+ $(top_srcdir)/build-aux/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+pkgdatadir = @pkgdatadir@
+pkgincludedir = @pkgincludedir@
+pkglibdir = @pkglibdir@
+pkglibexecdir = @pkglibexecdir@
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+ALLOCA_H = @ALLOCA_H@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
+AR = @AR@
+ARFLAGS = @ARFLAGS@
+ASSERT_H = @ASSERT_H@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
+BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
+BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
+BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
+BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BUILDINFO = @BUILDINFO@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_CFLAGS = @CHECK_CFLAGS@
+CHECK_LIBS = @CHECK_LIBS@
+CLOCK_TIME_LIB = @CLOCK_TIME_LIB@
+CONFIG_INCLUDE = @CONFIG_INCLUDE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CSCOPE = @CSCOPE@
+CTAGS = @CTAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DM_LIBS = @DM_LIBS@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@
+EMULTIHOP_VALUE = @EMULTIHOP_VALUE@
+ENABLE_DEVICE_MAPPER = @ENABLE_DEVICE_MAPPER@
+ENOLINK_HIDDEN = @ENOLINK_HIDDEN@
+ENOLINK_VALUE = @ENOLINK_VALUE@
+EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@
+EOVERFLOW_VALUE = @EOVERFLOW_VALUE@
+ERRNO_H = @ERRNO_H@
+ERROR_H = @ERROR_H@
+ETAGS = @ETAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILECMD = @FILECMD@
+GETOPT_CDEFS_H = @GETOPT_CDEFS_H@
+GETOPT_H = @GETOPT_H@
+GETRANDOM_LIB = @GETRANDOM_LIB@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@
+GL_CFLAG_GNULIB_WARNINGS = @GL_CFLAG_GNULIB_WARNINGS@
+GL_CXXFLAG_ALLOW_WARNINGS = @GL_CXXFLAG_ALLOW_WARNINGS@
+GL_GNULIB_ACCEPT = @GL_GNULIB_ACCEPT@
+GL_GNULIB_ACCEPT4 = @GL_GNULIB_ACCEPT4@
+GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@
+GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@
+GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@
+GL_GNULIB_BIND = @GL_GNULIB_BIND@
+GL_GNULIB_BTOWC = @GL_GNULIB_BTOWC@
+GL_GNULIB_CALLOC_GNU = @GL_GNULIB_CALLOC_GNU@
+GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@
+GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@
+GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@
+GL_GNULIB_CHMOD = @GL_GNULIB_CHMOD@
+GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@
+GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@
+GL_GNULIB_CONNECT = @GL_GNULIB_CONNECT@
+GL_GNULIB_COPY_FILE_RANGE = @GL_GNULIB_COPY_FILE_RANGE@
+GL_GNULIB_CREAT = @GL_GNULIB_CREAT@
+GL_GNULIB_CTIME = @GL_GNULIB_CTIME@
+GL_GNULIB_DPRINTF = @GL_GNULIB_DPRINTF@
+GL_GNULIB_DUP = @GL_GNULIB_DUP@
+GL_GNULIB_DUP2 = @GL_GNULIB_DUP2@
+GL_GNULIB_DUP3 = @GL_GNULIB_DUP3@
+GL_GNULIB_DUPLOCALE = @GL_GNULIB_DUPLOCALE@
+GL_GNULIB_ENVIRON = @GL_GNULIB_ENVIRON@
+GL_GNULIB_EUIDACCESS = @GL_GNULIB_EUIDACCESS@
+GL_GNULIB_EXECL = @GL_GNULIB_EXECL@
+GL_GNULIB_EXECLE = @GL_GNULIB_EXECLE@
+GL_GNULIB_EXECLP = @GL_GNULIB_EXECLP@
+GL_GNULIB_EXECV = @GL_GNULIB_EXECV@
+GL_GNULIB_EXECVE = @GL_GNULIB_EXECVE@
+GL_GNULIB_EXECVP = @GL_GNULIB_EXECVP@
+GL_GNULIB_EXECVPE = @GL_GNULIB_EXECVPE@
+GL_GNULIB_EXPLICIT_BZERO = @GL_GNULIB_EXPLICIT_BZERO@
+GL_GNULIB_FACCESSAT = @GL_GNULIB_FACCESSAT@
+GL_GNULIB_FCHDIR = @GL_GNULIB_FCHDIR@
+GL_GNULIB_FCHMODAT = @GL_GNULIB_FCHMODAT@
+GL_GNULIB_FCHOWNAT = @GL_GNULIB_FCHOWNAT@
+GL_GNULIB_FCLOSE = @GL_GNULIB_FCLOSE@
+GL_GNULIB_FCNTL = @GL_GNULIB_FCNTL@
+GL_GNULIB_FDATASYNC = @GL_GNULIB_FDATASYNC@
+GL_GNULIB_FDOPEN = @GL_GNULIB_FDOPEN@
+GL_GNULIB_FFLUSH = @GL_GNULIB_FFLUSH@
+GL_GNULIB_FFSL = @GL_GNULIB_FFSL@
+GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@
+GL_GNULIB_FGETC = @GL_GNULIB_FGETC@
+GL_GNULIB_FGETS = @GL_GNULIB_FGETS@
+GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@
+GL_GNULIB_FOPEN_GNU = @GL_GNULIB_FOPEN_GNU@
+GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@
+GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@
+GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@
+GL_GNULIB_FPUTC = @GL_GNULIB_FPUTC@
+GL_GNULIB_FPUTS = @GL_GNULIB_FPUTS@
+GL_GNULIB_FREAD = @GL_GNULIB_FREAD@
+GL_GNULIB_FREE_POSIX = @GL_GNULIB_FREE_POSIX@
+GL_GNULIB_FREOPEN = @GL_GNULIB_FREOPEN@
+GL_GNULIB_FSCANF = @GL_GNULIB_FSCANF@
+GL_GNULIB_FSEEK = @GL_GNULIB_FSEEK@
+GL_GNULIB_FSEEKO = @GL_GNULIB_FSEEKO@
+GL_GNULIB_FSTAT = @GL_GNULIB_FSTAT@
+GL_GNULIB_FSTATAT = @GL_GNULIB_FSTATAT@
+GL_GNULIB_FSYNC = @GL_GNULIB_FSYNC@
+GL_GNULIB_FTELL = @GL_GNULIB_FTELL@
+GL_GNULIB_FTELLO = @GL_GNULIB_FTELLO@
+GL_GNULIB_FTRUNCATE = @GL_GNULIB_FTRUNCATE@
+GL_GNULIB_FUTIMENS = @GL_GNULIB_FUTIMENS@
+GL_GNULIB_FWRITE = @GL_GNULIB_FWRITE@
+GL_GNULIB_GETC = @GL_GNULIB_GETC@
+GL_GNULIB_GETCHAR = @GL_GNULIB_GETCHAR@
+GL_GNULIB_GETCWD = @GL_GNULIB_GETCWD@
+GL_GNULIB_GETDELIM = @GL_GNULIB_GETDELIM@
+GL_GNULIB_GETDOMAINNAME = @GL_GNULIB_GETDOMAINNAME@
+GL_GNULIB_GETDTABLESIZE = @GL_GNULIB_GETDTABLESIZE@
+GL_GNULIB_GETENTROPY = @GL_GNULIB_GETENTROPY@
+GL_GNULIB_GETGROUPS = @GL_GNULIB_GETGROUPS@
+GL_GNULIB_GETHOSTNAME = @GL_GNULIB_GETHOSTNAME@
+GL_GNULIB_GETLINE = @GL_GNULIB_GETLINE@
+GL_GNULIB_GETLOADAVG = @GL_GNULIB_GETLOADAVG@
+GL_GNULIB_GETLOGIN = @GL_GNULIB_GETLOGIN@
+GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@
+GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@
+GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@
+GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@
+GL_GNULIB_GETPASS_GNU = @GL_GNULIB_GETPASS_GNU@
+GL_GNULIB_GETPEERNAME = @GL_GNULIB_GETPEERNAME@
+GL_GNULIB_GETPROGNAME = @GL_GNULIB_GETPROGNAME@
+GL_GNULIB_GETRANDOM = @GL_GNULIB_GETRANDOM@
+GL_GNULIB_GETSOCKNAME = @GL_GNULIB_GETSOCKNAME@
+GL_GNULIB_GETSOCKOPT = @GL_GNULIB_GETSOCKOPT@
+GL_GNULIB_GETSUBOPT = @GL_GNULIB_GETSUBOPT@
+GL_GNULIB_GETTIMEOFDAY = @GL_GNULIB_GETTIMEOFDAY@
+GL_GNULIB_GETUMASK = @GL_GNULIB_GETUMASK@
+GL_GNULIB_GETUSERSHELL = @GL_GNULIB_GETUSERSHELL@
+GL_GNULIB_GRANTPT = @GL_GNULIB_GRANTPT@
+GL_GNULIB_GROUP_MEMBER = @GL_GNULIB_GROUP_MEMBER@
+GL_GNULIB_IMAXABS = @GL_GNULIB_IMAXABS@
+GL_GNULIB_IMAXDIV = @GL_GNULIB_IMAXDIV@
+GL_GNULIB_INET_NTOP = @GL_GNULIB_INET_NTOP@
+GL_GNULIB_INET_PTON = @GL_GNULIB_INET_PTON@
+GL_GNULIB_IOCTL = @GL_GNULIB_IOCTL@
+GL_GNULIB_ISATTY = @GL_GNULIB_ISATTY@
+GL_GNULIB_ISBLANK = @GL_GNULIB_ISBLANK@
+GL_GNULIB_ISWBLANK = @GL_GNULIB_ISWBLANK@
+GL_GNULIB_ISWCTYPE = @GL_GNULIB_ISWCTYPE@
+GL_GNULIB_ISWDIGIT = @GL_GNULIB_ISWDIGIT@
+GL_GNULIB_ISWXDIGIT = @GL_GNULIB_ISWXDIGIT@
+GL_GNULIB_LCHMOD = @GL_GNULIB_LCHMOD@
+GL_GNULIB_LCHOWN = @GL_GNULIB_LCHOWN@
+GL_GNULIB_LINK = @GL_GNULIB_LINK@
+GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@
+GL_GNULIB_LISTEN = @GL_GNULIB_LISTEN@
+GL_GNULIB_LOCALECONV = @GL_GNULIB_LOCALECONV@
+GL_GNULIB_LOCALENAME = @GL_GNULIB_LOCALENAME@
+GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@
+GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@
+GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@
+GL_GNULIB_MALLOC_GNU = @GL_GNULIB_MALLOC_GNU@
+GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@
+GL_GNULIB_MBRLEN = @GL_GNULIB_MBRLEN@
+GL_GNULIB_MBRTOWC = @GL_GNULIB_MBRTOWC@
+GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@
+GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@
+GL_GNULIB_MBSCHR = @GL_GNULIB_MBSCHR@
+GL_GNULIB_MBSCSPN = @GL_GNULIB_MBSCSPN@
+GL_GNULIB_MBSINIT = @GL_GNULIB_MBSINIT@
+GL_GNULIB_MBSLEN = @GL_GNULIB_MBSLEN@
+GL_GNULIB_MBSNCASECMP = @GL_GNULIB_MBSNCASECMP@
+GL_GNULIB_MBSNLEN = @GL_GNULIB_MBSNLEN@
+GL_GNULIB_MBSNRTOWCS = @GL_GNULIB_MBSNRTOWCS@
+GL_GNULIB_MBSPBRK = @GL_GNULIB_MBSPBRK@
+GL_GNULIB_MBSPCASECMP = @GL_GNULIB_MBSPCASECMP@
+GL_GNULIB_MBSRCHR = @GL_GNULIB_MBSRCHR@
+GL_GNULIB_MBSRTOWCS = @GL_GNULIB_MBSRTOWCS@
+GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@
+GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@
+GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@
+GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@
+GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@
+GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@
+GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@
+GL_GNULIB_MDA_CHMOD = @GL_GNULIB_MDA_CHMOD@
+GL_GNULIB_MDA_CLOSE = @GL_GNULIB_MDA_CLOSE@
+GL_GNULIB_MDA_CREAT = @GL_GNULIB_MDA_CREAT@
+GL_GNULIB_MDA_DUP = @GL_GNULIB_MDA_DUP@
+GL_GNULIB_MDA_DUP2 = @GL_GNULIB_MDA_DUP2@
+GL_GNULIB_MDA_ECVT = @GL_GNULIB_MDA_ECVT@
+GL_GNULIB_MDA_EXECL = @GL_GNULIB_MDA_EXECL@
+GL_GNULIB_MDA_EXECLE = @GL_GNULIB_MDA_EXECLE@
+GL_GNULIB_MDA_EXECLP = @GL_GNULIB_MDA_EXECLP@
+GL_GNULIB_MDA_EXECV = @GL_GNULIB_MDA_EXECV@
+GL_GNULIB_MDA_EXECVE = @GL_GNULIB_MDA_EXECVE@
+GL_GNULIB_MDA_EXECVP = @GL_GNULIB_MDA_EXECVP@
+GL_GNULIB_MDA_EXECVPE = @GL_GNULIB_MDA_EXECVPE@
+GL_GNULIB_MDA_FCLOSEALL = @GL_GNULIB_MDA_FCLOSEALL@
+GL_GNULIB_MDA_FCVT = @GL_GNULIB_MDA_FCVT@
+GL_GNULIB_MDA_FDOPEN = @GL_GNULIB_MDA_FDOPEN@
+GL_GNULIB_MDA_FILENO = @GL_GNULIB_MDA_FILENO@
+GL_GNULIB_MDA_GCVT = @GL_GNULIB_MDA_GCVT@
+GL_GNULIB_MDA_GETCWD = @GL_GNULIB_MDA_GETCWD@
+GL_GNULIB_MDA_GETPID = @GL_GNULIB_MDA_GETPID@
+GL_GNULIB_MDA_GETW = @GL_GNULIB_MDA_GETW@
+GL_GNULIB_MDA_ISATTY = @GL_GNULIB_MDA_ISATTY@
+GL_GNULIB_MDA_LSEEK = @GL_GNULIB_MDA_LSEEK@
+GL_GNULIB_MDA_MEMCCPY = @GL_GNULIB_MDA_MEMCCPY@
+GL_GNULIB_MDA_MKDIR = @GL_GNULIB_MDA_MKDIR@
+GL_GNULIB_MDA_MKTEMP = @GL_GNULIB_MDA_MKTEMP@
+GL_GNULIB_MDA_OPEN = @GL_GNULIB_MDA_OPEN@
+GL_GNULIB_MDA_PUTENV = @GL_GNULIB_MDA_PUTENV@
+GL_GNULIB_MDA_PUTW = @GL_GNULIB_MDA_PUTW@
+GL_GNULIB_MDA_READ = @GL_GNULIB_MDA_READ@
+GL_GNULIB_MDA_RMDIR = @GL_GNULIB_MDA_RMDIR@
+GL_GNULIB_MDA_STRDUP = @GL_GNULIB_MDA_STRDUP@
+GL_GNULIB_MDA_SWAB = @GL_GNULIB_MDA_SWAB@
+GL_GNULIB_MDA_TEMPNAM = @GL_GNULIB_MDA_TEMPNAM@
+GL_GNULIB_MDA_TZSET = @GL_GNULIB_MDA_TZSET@
+GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@
+GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@
+GL_GNULIB_MDA_WCSDUP = @GL_GNULIB_MDA_WCSDUP@
+GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@
+GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@
+GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@
+GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@
+GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@
+GL_GNULIB_MEMSET_EXPLICIT = @GL_GNULIB_MEMSET_EXPLICIT@
+GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@
+GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@
+GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@
+GL_GNULIB_MKFIFO = @GL_GNULIB_MKFIFO@
+GL_GNULIB_MKFIFOAT = @GL_GNULIB_MKFIFOAT@
+GL_GNULIB_MKNOD = @GL_GNULIB_MKNOD@
+GL_GNULIB_MKNODAT = @GL_GNULIB_MKNODAT@
+GL_GNULIB_MKOSTEMP = @GL_GNULIB_MKOSTEMP@
+GL_GNULIB_MKOSTEMPS = @GL_GNULIB_MKOSTEMPS@
+GL_GNULIB_MKSTEMP = @GL_GNULIB_MKSTEMP@
+GL_GNULIB_MKSTEMPS = @GL_GNULIB_MKSTEMPS@
+GL_GNULIB_MKTIME = @GL_GNULIB_MKTIME@
+GL_GNULIB_NANOSLEEP = @GL_GNULIB_NANOSLEEP@
+GL_GNULIB_NL_LANGINFO = @GL_GNULIB_NL_LANGINFO@
+GL_GNULIB_NONBLOCKING = @GL_GNULIB_NONBLOCKING@
+GL_GNULIB_OBSTACK_PRINTF = @GL_GNULIB_OBSTACK_PRINTF@
+GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@
+GL_GNULIB_OPEN = @GL_GNULIB_OPEN@
+GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@
+GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@
+GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@
+GL_GNULIB_PERROR = @GL_GNULIB_PERROR@
+GL_GNULIB_PIPE = @GL_GNULIB_PIPE@
+GL_GNULIB_PIPE2 = @GL_GNULIB_PIPE2@
+GL_GNULIB_POPEN = @GL_GNULIB_POPEN@
+GL_GNULIB_POSIX_MEMALIGN = @GL_GNULIB_POSIX_MEMALIGN@
+GL_GNULIB_POSIX_OPENPT = @GL_GNULIB_POSIX_OPENPT@
+GL_GNULIB_PREAD = @GL_GNULIB_PREAD@
+GL_GNULIB_PRINTF = @GL_GNULIB_PRINTF@
+GL_GNULIB_PRINTF_POSIX = @GL_GNULIB_PRINTF_POSIX@
+GL_GNULIB_PSELECT = @GL_GNULIB_PSELECT@
+GL_GNULIB_PTHREAD_COND = @GL_GNULIB_PTHREAD_COND@
+GL_GNULIB_PTHREAD_MUTEX = @GL_GNULIB_PTHREAD_MUTEX@
+GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK = @GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
+GL_GNULIB_PTHREAD_ONCE = @GL_GNULIB_PTHREAD_ONCE@
+GL_GNULIB_PTHREAD_RWLOCK = @GL_GNULIB_PTHREAD_RWLOCK@
+GL_GNULIB_PTHREAD_SIGMASK = @GL_GNULIB_PTHREAD_SIGMASK@
+GL_GNULIB_PTHREAD_SPIN = @GL_GNULIB_PTHREAD_SPIN@
+GL_GNULIB_PTHREAD_THREAD = @GL_GNULIB_PTHREAD_THREAD@
+GL_GNULIB_PTHREAD_TSS = @GL_GNULIB_PTHREAD_TSS@
+GL_GNULIB_PTSNAME = @GL_GNULIB_PTSNAME@
+GL_GNULIB_PTSNAME_R = @GL_GNULIB_PTSNAME_R@
+GL_GNULIB_PUTC = @GL_GNULIB_PUTC@
+GL_GNULIB_PUTCHAR = @GL_GNULIB_PUTCHAR@
+GL_GNULIB_PUTENV = @GL_GNULIB_PUTENV@
+GL_GNULIB_PUTS = @GL_GNULIB_PUTS@
+GL_GNULIB_PWRITE = @GL_GNULIB_PWRITE@
+GL_GNULIB_QSORT_R = @GL_GNULIB_QSORT_R@
+GL_GNULIB_RAISE = @GL_GNULIB_RAISE@
+GL_GNULIB_RANDOM = @GL_GNULIB_RANDOM@
+GL_GNULIB_RANDOM_R = @GL_GNULIB_RANDOM_R@
+GL_GNULIB_RAWMEMCHR = @GL_GNULIB_RAWMEMCHR@
+GL_GNULIB_READ = @GL_GNULIB_READ@
+GL_GNULIB_READLINK = @GL_GNULIB_READLINK@
+GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@
+GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@
+GL_GNULIB_REALLOC_GNU = @GL_GNULIB_REALLOC_GNU@
+GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@
+GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@
+GL_GNULIB_RECV = @GL_GNULIB_RECV@
+GL_GNULIB_RECVFROM = @GL_GNULIB_RECVFROM@
+GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@
+GL_GNULIB_RENAME = @GL_GNULIB_RENAME@
+GL_GNULIB_RENAMEAT = @GL_GNULIB_RENAMEAT@
+GL_GNULIB_RMDIR = @GL_GNULIB_RMDIR@
+GL_GNULIB_RPMATCH = @GL_GNULIB_RPMATCH@
+GL_GNULIB_SCANF = @GL_GNULIB_SCANF@
+GL_GNULIB_SCHED_YIELD = @GL_GNULIB_SCHED_YIELD@
+GL_GNULIB_SECURE_GETENV = @GL_GNULIB_SECURE_GETENV@
+GL_GNULIB_SELECT = @GL_GNULIB_SELECT@
+GL_GNULIB_SEND = @GL_GNULIB_SEND@
+GL_GNULIB_SENDTO = @GL_GNULIB_SENDTO@
+GL_GNULIB_SETENV = @GL_GNULIB_SETENV@
+GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@
+GL_GNULIB_SETLOCALE = @GL_GNULIB_SETLOCALE@
+GL_GNULIB_SETLOCALE_NULL = @GL_GNULIB_SETLOCALE_NULL@
+GL_GNULIB_SETSOCKOPT = @GL_GNULIB_SETSOCKOPT@
+GL_GNULIB_SHUTDOWN = @GL_GNULIB_SHUTDOWN@
+GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@
+GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@
+GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@
+GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@
+GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@
+GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@
+GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@
+GL_GNULIB_SOCKET = @GL_GNULIB_SOCKET@
+GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@
+GL_GNULIB_STAT = @GL_GNULIB_STAT@
+GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@
+GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@
+GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@
+GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@
+GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@
+GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@
+GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@
+GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@
+GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@
+GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@
+GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@
+GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@
+GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@
+GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@
+GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@
+GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@
+GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@
+GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@
+GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@
+GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@
+GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@
+GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@
+GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@
+GL_GNULIB_STRTOLD = @GL_GNULIB_STRTOLD@
+GL_GNULIB_STRTOLL = @GL_GNULIB_STRTOLL@
+GL_GNULIB_STRTOUL = @GL_GNULIB_STRTOUL@
+GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@
+GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@
+GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@
+GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@
+GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@
+GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@
+GL_GNULIB_TIME = @GL_GNULIB_TIME@
+GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@
+GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@
+GL_GNULIB_TIMESPEC_GETRES = @GL_GNULIB_TIMESPEC_GETRES@
+GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@
+GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@
+GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@
+GL_GNULIB_TOWCTRANS = @GL_GNULIB_TOWCTRANS@
+GL_GNULIB_TRUNCATE = @GL_GNULIB_TRUNCATE@
+GL_GNULIB_TTYNAME_R = @GL_GNULIB_TTYNAME_R@
+GL_GNULIB_TZSET = @GL_GNULIB_TZSET@
+GL_GNULIB_UNISTD_H_GETOPT = @GL_GNULIB_UNISTD_H_GETOPT@
+GL_GNULIB_UNISTD_H_NONBLOCKING = @GL_GNULIB_UNISTD_H_NONBLOCKING@
+GL_GNULIB_UNISTD_H_SIGPIPE = @GL_GNULIB_UNISTD_H_SIGPIPE@
+GL_GNULIB_UNLINK = @GL_GNULIB_UNLINK@
+GL_GNULIB_UNLINKAT = @GL_GNULIB_UNLINKAT@
+GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@
+GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@
+GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@
+GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@
+GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@
+GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@
+GL_GNULIB_VFPRINTF = @GL_GNULIB_VFPRINTF@
+GL_GNULIB_VFPRINTF_POSIX = @GL_GNULIB_VFPRINTF_POSIX@
+GL_GNULIB_VFSCANF = @GL_GNULIB_VFSCANF@
+GL_GNULIB_VPRINTF = @GL_GNULIB_VPRINTF@
+GL_GNULIB_VPRINTF_POSIX = @GL_GNULIB_VPRINTF_POSIX@
+GL_GNULIB_VSCANF = @GL_GNULIB_VSCANF@
+GL_GNULIB_VSNPRINTF = @GL_GNULIB_VSNPRINTF@
+GL_GNULIB_VSPRINTF_POSIX = @GL_GNULIB_VSPRINTF_POSIX@
+GL_GNULIB_WCPCPY = @GL_GNULIB_WCPCPY@
+GL_GNULIB_WCPNCPY = @GL_GNULIB_WCPNCPY@
+GL_GNULIB_WCRTOMB = @GL_GNULIB_WCRTOMB@
+GL_GNULIB_WCSCASECMP = @GL_GNULIB_WCSCASECMP@
+GL_GNULIB_WCSCAT = @GL_GNULIB_WCSCAT@
+GL_GNULIB_WCSCHR = @GL_GNULIB_WCSCHR@
+GL_GNULIB_WCSCMP = @GL_GNULIB_WCSCMP@
+GL_GNULIB_WCSCOLL = @GL_GNULIB_WCSCOLL@
+GL_GNULIB_WCSCPY = @GL_GNULIB_WCSCPY@
+GL_GNULIB_WCSCSPN = @GL_GNULIB_WCSCSPN@
+GL_GNULIB_WCSDUP = @GL_GNULIB_WCSDUP@
+GL_GNULIB_WCSFTIME = @GL_GNULIB_WCSFTIME@
+GL_GNULIB_WCSLEN = @GL_GNULIB_WCSLEN@
+GL_GNULIB_WCSNCASECMP = @GL_GNULIB_WCSNCASECMP@
+GL_GNULIB_WCSNCAT = @GL_GNULIB_WCSNCAT@
+GL_GNULIB_WCSNCMP = @GL_GNULIB_WCSNCMP@
+GL_GNULIB_WCSNCPY = @GL_GNULIB_WCSNCPY@
+GL_GNULIB_WCSNLEN = @GL_GNULIB_WCSNLEN@
+GL_GNULIB_WCSNRTOMBS = @GL_GNULIB_WCSNRTOMBS@
+GL_GNULIB_WCSPBRK = @GL_GNULIB_WCSPBRK@
+GL_GNULIB_WCSRCHR = @GL_GNULIB_WCSRCHR@
+GL_GNULIB_WCSRTOMBS = @GL_GNULIB_WCSRTOMBS@
+GL_GNULIB_WCSSPN = @GL_GNULIB_WCSSPN@
+GL_GNULIB_WCSSTR = @GL_GNULIB_WCSSTR@
+GL_GNULIB_WCSTOK = @GL_GNULIB_WCSTOK@
+GL_GNULIB_WCSWIDTH = @GL_GNULIB_WCSWIDTH@
+GL_GNULIB_WCSXFRM = @GL_GNULIB_WCSXFRM@
+GL_GNULIB_WCTOB = @GL_GNULIB_WCTOB@
+GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@
+GL_GNULIB_WCTRANS = @GL_GNULIB_WCTRANS@
+GL_GNULIB_WCTYPE = @GL_GNULIB_WCTYPE@
+GL_GNULIB_WCWIDTH = @GL_GNULIB_WCWIDTH@
+GL_GNULIB_WMEMCHR = @GL_GNULIB_WMEMCHR@
+GL_GNULIB_WMEMCMP = @GL_GNULIB_WMEMCMP@
+GL_GNULIB_WMEMCPY = @GL_GNULIB_WMEMCPY@
+GL_GNULIB_WMEMMOVE = @GL_GNULIB_WMEMMOVE@
+GL_GNULIB_WMEMPCPY = @GL_GNULIB_WMEMPCPY@
+GL_GNULIB_WMEMSET = @GL_GNULIB_WMEMSET@
+GL_GNULIB_WRITE = @GL_GNULIB_WRITE@
+GL_GNULIB__EXIT = @GL_GNULIB__EXIT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@
+GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@
+GREP = @GREP@
+HARD_LOCALE_LIB = @HARD_LOCALE_LIB@
+HAVE_ACCEPT4 = @HAVE_ACCEPT4@
+HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@
+HAVE_ALLOCA_H = @HAVE_ALLOCA_H@
+HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@
+HAVE_ATOLL = @HAVE_ATOLL@
+HAVE_BTOWC = @HAVE_BTOWC@
+HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@
+HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@
+HAVE_CHOWN = @HAVE_CHOWN@
+HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@
+HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@
+HAVE_DECL_ECVT = @HAVE_DECL_ECVT@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
+HAVE_DECL_EXECVPE = @HAVE_DECL_EXECVPE@
+HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@
+HAVE_DECL_FCLOSEALL = @HAVE_DECL_FCLOSEALL@
+HAVE_DECL_FCVT = @HAVE_DECL_FCVT@
+HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@
+HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@
+HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@
+HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@
+HAVE_DECL_GCVT = @HAVE_DECL_GCVT@
+HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
+HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@
+HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
+HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@
+HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@
+HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
+HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@
+HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@
+HAVE_DECL_GETW = @HAVE_DECL_GETW@
+HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@
+HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@
+HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@
+HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@
+HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@
+HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@
+HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
+HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
+HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@
+HAVE_DECL_PUTW = @HAVE_DECL_PUTW@
+HAVE_DECL_SETENV = @HAVE_DECL_SETENV@
+HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@
+HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@
+HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
+HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
+HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@
+HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
+HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
+HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@
+HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
+HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@
+HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@
+HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@
+HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@
+HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
+HAVE_DECL_WCSDUP = @HAVE_DECL_WCSDUP@
+HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@
+HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
+HAVE_DPRINTF = @HAVE_DPRINTF@
+HAVE_DUP3 = @HAVE_DUP3@
+HAVE_DUPLOCALE = @HAVE_DUPLOCALE@
+HAVE_ERROR = @HAVE_ERROR@
+HAVE_ERROR_AT_LINE = @HAVE_ERROR_AT_LINE@
+HAVE_ERROR_H = @HAVE_ERROR_H@
+HAVE_EUIDACCESS = @HAVE_EUIDACCESS@
+HAVE_EXECVPE = @HAVE_EXECVPE@
+HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@
+HAVE_FACCESSAT = @HAVE_FACCESSAT@
+HAVE_FCHDIR = @HAVE_FCHDIR@
+HAVE_FCHMODAT = @HAVE_FCHMODAT@
+HAVE_FCHOWNAT = @HAVE_FCHOWNAT@
+HAVE_FCNTL = @HAVE_FCNTL@
+HAVE_FDATASYNC = @HAVE_FDATASYNC@
+HAVE_FEATURES_H = @HAVE_FEATURES_H@
+HAVE_FFSL = @HAVE_FFSL@
+HAVE_FFSLL = @HAVE_FFSLL@
+HAVE_FREELOCALE = @HAVE_FREELOCALE@
+HAVE_FSEEKO = @HAVE_FSEEKO@
+HAVE_FSTATAT = @HAVE_FSTATAT@
+HAVE_FSYNC = @HAVE_FSYNC@
+HAVE_FTELLO = @HAVE_FTELLO@
+HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_FUTIMENS = @HAVE_FUTIMENS@
+HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@
+HAVE_GETENTROPY = @HAVE_GETENTROPY@
+HAVE_GETGROUPS = @HAVE_GETGROUPS@
+HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@
+HAVE_GETLOGIN = @HAVE_GETLOGIN@
+HAVE_GETOPT_H = @HAVE_GETOPT_H@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
+HAVE_GETPASS = @HAVE_GETPASS@
+HAVE_GETPROGNAME = @HAVE_GETPROGNAME@
+HAVE_GETRANDOM = @HAVE_GETRANDOM@
+HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
+HAVE_GETUMASK = @HAVE_GETUMASK@
+HAVE_GRANTPT = @HAVE_GRANTPT@
+HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
+HAVE_IMAXABS = @HAVE_IMAXABS@
+HAVE_IMAXDIV = @HAVE_IMAXDIV@
+HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@
+HAVE_INITSTATE = @HAVE_INITSTATE@
+HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
+HAVE_ISBLANK = @HAVE_ISBLANK@
+HAVE_ISWBLANK = @HAVE_ISWBLANK@
+HAVE_ISWCNTRL = @HAVE_ISWCNTRL@
+HAVE_LANGINFO_ALTMON = @HAVE_LANGINFO_ALTMON@
+HAVE_LANGINFO_CODESET = @HAVE_LANGINFO_CODESET@
+HAVE_LANGINFO_ERA = @HAVE_LANGINFO_ERA@
+HAVE_LANGINFO_H = @HAVE_LANGINFO_H@
+HAVE_LANGINFO_T_FMT_AMPM = @HAVE_LANGINFO_T_FMT_AMPM@
+HAVE_LANGINFO_YESEXPR = @HAVE_LANGINFO_YESEXPR@
+HAVE_LCHMOD = @HAVE_LCHMOD@
+HAVE_LCHOWN = @HAVE_LCHOWN@
+HAVE_LINK = @HAVE_LINK@
+HAVE_LINKAT = @HAVE_LINKAT@
+HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
+HAVE_MBRLEN = @HAVE_MBRLEN@
+HAVE_MBRTOWC = @HAVE_MBRTOWC@
+HAVE_MBSINIT = @HAVE_MBSINIT@
+HAVE_MBSLEN = @HAVE_MBSLEN@
+HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@
+HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@
+HAVE_MBTOWC = @HAVE_MBTOWC@
+HAVE_MEMPCPY = @HAVE_MEMPCPY@
+HAVE_MEMSET_EXPLICIT = @HAVE_MEMSET_EXPLICIT@
+HAVE_MKDIRAT = @HAVE_MKDIRAT@
+HAVE_MKDTEMP = @HAVE_MKDTEMP@
+HAVE_MKFIFO = @HAVE_MKFIFO@
+HAVE_MKFIFOAT = @HAVE_MKFIFOAT@
+HAVE_MKNOD = @HAVE_MKNOD@
+HAVE_MKNODAT = @HAVE_MKNODAT@
+HAVE_MKOSTEMP = @HAVE_MKOSTEMP@
+HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@
+HAVE_MKSTEMP = @HAVE_MKSTEMP@
+HAVE_MKSTEMPS = @HAVE_MKSTEMPS@
+HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@
+HAVE_NANOSLEEP = @HAVE_NANOSLEEP@
+HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_NEWLOCALE = @HAVE_NEWLOCALE@
+HAVE_NL_LANGINFO = @HAVE_NL_LANGINFO@
+HAVE_OPENAT = @HAVE_OPENAT@
+HAVE_OS_H = @HAVE_OS_H@
+HAVE_PCLOSE = @HAVE_PCLOSE@
+HAVE_PIPE = @HAVE_PIPE@
+HAVE_PIPE2 = @HAVE_PIPE2@
+HAVE_POPEN = @HAVE_POPEN@
+HAVE_POSIX_MEMALIGN = @HAVE_POSIX_MEMALIGN@
+HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@
+HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@
+HAVE_PREAD = @HAVE_PREAD@
+HAVE_PSELECT = @HAVE_PSELECT@
+HAVE_PTHREAD_ATTR_DESTROY = @HAVE_PTHREAD_ATTR_DESTROY@
+HAVE_PTHREAD_ATTR_GETDETACHSTATE = @HAVE_PTHREAD_ATTR_GETDETACHSTATE@
+HAVE_PTHREAD_ATTR_INIT = @HAVE_PTHREAD_ATTR_INIT@
+HAVE_PTHREAD_ATTR_SETDETACHSTATE = @HAVE_PTHREAD_ATTR_SETDETACHSTATE@
+HAVE_PTHREAD_CONDATTR_DESTROY = @HAVE_PTHREAD_CONDATTR_DESTROY@
+HAVE_PTHREAD_CONDATTR_INIT = @HAVE_PTHREAD_CONDATTR_INIT@
+HAVE_PTHREAD_COND_BROADCAST = @HAVE_PTHREAD_COND_BROADCAST@
+HAVE_PTHREAD_COND_DESTROY = @HAVE_PTHREAD_COND_DESTROY@
+HAVE_PTHREAD_COND_INIT = @HAVE_PTHREAD_COND_INIT@
+HAVE_PTHREAD_COND_SIGNAL = @HAVE_PTHREAD_COND_SIGNAL@
+HAVE_PTHREAD_COND_TIMEDWAIT = @HAVE_PTHREAD_COND_TIMEDWAIT@
+HAVE_PTHREAD_COND_WAIT = @HAVE_PTHREAD_COND_WAIT@
+HAVE_PTHREAD_CREATE = @HAVE_PTHREAD_CREATE@
+HAVE_PTHREAD_CREATE_DETACHED = @HAVE_PTHREAD_CREATE_DETACHED@
+HAVE_PTHREAD_DETACH = @HAVE_PTHREAD_DETACH@
+HAVE_PTHREAD_EQUAL = @HAVE_PTHREAD_EQUAL@
+HAVE_PTHREAD_EXIT = @HAVE_PTHREAD_EXIT@
+HAVE_PTHREAD_GETSPECIFIC = @HAVE_PTHREAD_GETSPECIFIC@
+HAVE_PTHREAD_H = @HAVE_PTHREAD_H@
+HAVE_PTHREAD_JOIN = @HAVE_PTHREAD_JOIN@
+HAVE_PTHREAD_KEY_CREATE = @HAVE_PTHREAD_KEY_CREATE@
+HAVE_PTHREAD_KEY_DELETE = @HAVE_PTHREAD_KEY_DELETE@
+HAVE_PTHREAD_MUTEXATTR_DESTROY = @HAVE_PTHREAD_MUTEXATTR_DESTROY@
+HAVE_PTHREAD_MUTEXATTR_GETROBUST = @HAVE_PTHREAD_MUTEXATTR_GETROBUST@
+HAVE_PTHREAD_MUTEXATTR_GETTYPE = @HAVE_PTHREAD_MUTEXATTR_GETTYPE@
+HAVE_PTHREAD_MUTEXATTR_INIT = @HAVE_PTHREAD_MUTEXATTR_INIT@
+HAVE_PTHREAD_MUTEXATTR_SETROBUST = @HAVE_PTHREAD_MUTEXATTR_SETROBUST@
+HAVE_PTHREAD_MUTEXATTR_SETTYPE = @HAVE_PTHREAD_MUTEXATTR_SETTYPE@
+HAVE_PTHREAD_MUTEX_DESTROY = @HAVE_PTHREAD_MUTEX_DESTROY@
+HAVE_PTHREAD_MUTEX_INIT = @HAVE_PTHREAD_MUTEX_INIT@
+HAVE_PTHREAD_MUTEX_LOCK = @HAVE_PTHREAD_MUTEX_LOCK@
+HAVE_PTHREAD_MUTEX_RECURSIVE = @HAVE_PTHREAD_MUTEX_RECURSIVE@
+HAVE_PTHREAD_MUTEX_ROBUST = @HAVE_PTHREAD_MUTEX_ROBUST@
+HAVE_PTHREAD_MUTEX_TIMEDLOCK = @HAVE_PTHREAD_MUTEX_TIMEDLOCK@
+HAVE_PTHREAD_MUTEX_TRYLOCK = @HAVE_PTHREAD_MUTEX_TRYLOCK@
+HAVE_PTHREAD_MUTEX_UNLOCK = @HAVE_PTHREAD_MUTEX_UNLOCK@
+HAVE_PTHREAD_ONCE = @HAVE_PTHREAD_ONCE@
+HAVE_PTHREAD_PROCESS_SHARED = @HAVE_PTHREAD_PROCESS_SHARED@
+HAVE_PTHREAD_RWLOCKATTR_DESTROY = @HAVE_PTHREAD_RWLOCKATTR_DESTROY@
+HAVE_PTHREAD_RWLOCKATTR_INIT = @HAVE_PTHREAD_RWLOCKATTR_INIT@
+HAVE_PTHREAD_RWLOCK_DESTROY = @HAVE_PTHREAD_RWLOCK_DESTROY@
+HAVE_PTHREAD_RWLOCK_INIT = @HAVE_PTHREAD_RWLOCK_INIT@
+HAVE_PTHREAD_RWLOCK_RDLOCK = @HAVE_PTHREAD_RWLOCK_RDLOCK@
+HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
+HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
+HAVE_PTHREAD_RWLOCK_TRYRDLOCK = @HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
+HAVE_PTHREAD_RWLOCK_TRYWRLOCK = @HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
+HAVE_PTHREAD_RWLOCK_UNLOCK = @HAVE_PTHREAD_RWLOCK_UNLOCK@
+HAVE_PTHREAD_RWLOCK_WRLOCK = @HAVE_PTHREAD_RWLOCK_WRLOCK@
+HAVE_PTHREAD_SELF = @HAVE_PTHREAD_SELF@
+HAVE_PTHREAD_SETSPECIFIC = @HAVE_PTHREAD_SETSPECIFIC@
+HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@
+HAVE_PTHREAD_SPINLOCK_T = @HAVE_PTHREAD_SPINLOCK_T@
+HAVE_PTHREAD_SPIN_DESTROY = @HAVE_PTHREAD_SPIN_DESTROY@
+HAVE_PTHREAD_SPIN_INIT = @HAVE_PTHREAD_SPIN_INIT@
+HAVE_PTHREAD_SPIN_LOCK = @HAVE_PTHREAD_SPIN_LOCK@
+HAVE_PTHREAD_SPIN_TRYLOCK = @HAVE_PTHREAD_SPIN_TRYLOCK@
+HAVE_PTHREAD_SPIN_UNLOCK = @HAVE_PTHREAD_SPIN_UNLOCK@
+HAVE_PTHREAD_T = @HAVE_PTHREAD_T@
+HAVE_PTSNAME = @HAVE_PTSNAME@
+HAVE_PTSNAME_R = @HAVE_PTSNAME_R@
+HAVE_PWRITE = @HAVE_PWRITE@
+HAVE_QSORT_R = @HAVE_QSORT_R@
+HAVE_RAISE = @HAVE_RAISE@
+HAVE_RANDOM = @HAVE_RANDOM@
+HAVE_RANDOM_H = @HAVE_RANDOM_H@
+HAVE_RANDOM_R = @HAVE_RANDOM_R@
+HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@
+HAVE_READLINK = @HAVE_READLINK@
+HAVE_READLINKAT = @HAVE_READLINKAT@
+HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@
+HAVE_REALPATH = @HAVE_REALPATH@
+HAVE_RENAMEAT = @HAVE_RENAMEAT@
+HAVE_RPMATCH = @HAVE_RPMATCH@
+HAVE_SA_FAMILY_T = @HAVE_SA_FAMILY_T@
+HAVE_SCHED_H = @HAVE_SCHED_H@
+HAVE_SCHED_YIELD = @HAVE_SCHED_YIELD@
+HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@
+HAVE_SETENV = @HAVE_SETENV@
+HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@
+HAVE_SETSTATE = @HAVE_SETSTATE@
+HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@
+HAVE_SIGACTION = @HAVE_SIGACTION@
+HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@
+HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@
+HAVE_SIGINFO_T = @HAVE_SIGINFO_T@
+HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
+HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
+HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
+HAVE_SIGSET_T = @HAVE_SIGSET_T@
+HAVE_SLEEP = @HAVE_SLEEP@
+HAVE_STDINT_H = @HAVE_STDINT_H@
+HAVE_STPCPY = @HAVE_STPCPY@
+HAVE_STPNCPY = @HAVE_STPNCPY@
+HAVE_STRCASESTR = @HAVE_STRCASESTR@
+HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
+HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@
+HAVE_STRPBRK = @HAVE_STRPBRK@
+HAVE_STRPTIME = @HAVE_STRPTIME@
+HAVE_STRSEP = @HAVE_STRSEP@
+HAVE_STRTOD = @HAVE_STRTOD@
+HAVE_STRTOL = @HAVE_STRTOL@
+HAVE_STRTOLD = @HAVE_STRTOLD@
+HAVE_STRTOLL = @HAVE_STRTOLL@
+HAVE_STRTOUL = @HAVE_STRTOUL@
+HAVE_STRTOULL = @HAVE_STRTOULL@
+HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@
+HAVE_STRUCT_SCHED_PARAM = @HAVE_STRUCT_SCHED_PARAM@
+HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@
+HAVE_STRUCT_SOCKADDR_STORAGE = @HAVE_STRUCT_SOCKADDR_STORAGE@
+HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = @HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@
+HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
+HAVE_STRVERSCMP = @HAVE_STRVERSCMP@
+HAVE_SYMLINK = @HAVE_SYMLINK@
+HAVE_SYMLINKAT = @HAVE_SYMLINKAT@
+HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
+HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@
+HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_IOCTL_H = @HAVE_SYS_IOCTL_H@
+HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
+HAVE_SYS_RANDOM_H = @HAVE_SYS_RANDOM_H@
+HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@
+HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
+HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
+HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
+HAVE_SYS_UIO_H = @HAVE_SYS_UIO_H@
+HAVE_TIMEGM = @HAVE_TIMEGM@
+HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@
+HAVE_TIMESPEC_GETRES = @HAVE_TIMESPEC_GETRES@
+HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@
+HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
+HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNLINKAT = @HAVE_UNLINKAT@
+HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
+HAVE_USLEEP = @HAVE_USLEEP@
+HAVE_UTIMENSAT = @HAVE_UTIMENSAT@
+HAVE_VASPRINTF = @HAVE_VASPRINTF@
+HAVE_VDPRINTF = @HAVE_VDPRINTF@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+HAVE_WCHAR_H = @HAVE_WCHAR_H@
+HAVE_WCHAR_T = @HAVE_WCHAR_T@
+HAVE_WCPCPY = @HAVE_WCPCPY@
+HAVE_WCPNCPY = @HAVE_WCPNCPY@
+HAVE_WCRTOMB = @HAVE_WCRTOMB@
+HAVE_WCSCASECMP = @HAVE_WCSCASECMP@
+HAVE_WCSCAT = @HAVE_WCSCAT@
+HAVE_WCSCHR = @HAVE_WCSCHR@
+HAVE_WCSCMP = @HAVE_WCSCMP@
+HAVE_WCSCOLL = @HAVE_WCSCOLL@
+HAVE_WCSCPY = @HAVE_WCSCPY@
+HAVE_WCSCSPN = @HAVE_WCSCSPN@
+HAVE_WCSDUP = @HAVE_WCSDUP@
+HAVE_WCSFTIME = @HAVE_WCSFTIME@
+HAVE_WCSLEN = @HAVE_WCSLEN@
+HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@
+HAVE_WCSNCAT = @HAVE_WCSNCAT@
+HAVE_WCSNCMP = @HAVE_WCSNCMP@
+HAVE_WCSNCPY = @HAVE_WCSNCPY@
+HAVE_WCSNLEN = @HAVE_WCSNLEN@
+HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@
+HAVE_WCSPBRK = @HAVE_WCSPBRK@
+HAVE_WCSRCHR = @HAVE_WCSRCHR@
+HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@
+HAVE_WCSSPN = @HAVE_WCSSPN@
+HAVE_WCSSTR = @HAVE_WCSSTR@
+HAVE_WCSTOK = @HAVE_WCSTOK@
+HAVE_WCSWIDTH = @HAVE_WCSWIDTH@
+HAVE_WCSXFRM = @HAVE_WCSXFRM@
+HAVE_WCTRANS_T = @HAVE_WCTRANS_T@
+HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
+HAVE_WCTYPE_T = @HAVE_WCTYPE_T@
+HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
+HAVE_WINT_T = @HAVE_WINT_T@
+HAVE_WMEMCHR = @HAVE_WMEMCHR@
+HAVE_WMEMCMP = @HAVE_WMEMCMP@
+HAVE_WMEMCPY = @HAVE_WMEMCPY@
+HAVE_WMEMMOVE = @HAVE_WMEMMOVE@
+HAVE_WMEMPCPY = @HAVE_WMEMPCPY@
+HAVE_WMEMSET = @HAVE_WMEMSET@
+HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
+HAVE_XLOCALE_H = @HAVE_XLOCALE_H@
+HAVE__EXIT = @HAVE__EXIT@
+IGNORE_UNUSED_LIBRARIES_CFLAGS = @IGNORE_UNUSED_LIBRARIES_CFLAGS@
+INCLUDE_NEXT = @INCLUDE_NEXT@
+INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@
+INET_PTON_LIB = @INET_PTON_LIB@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@
+INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@
+INTLINCS = @INTLINCS@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBMULTITHREAD = @LIBMULTITHREAD@
+LIBOBJS = @LIBOBJS@
+LIBPMULTITHREAD = @LIBPMULTITHREAD@
+LIBPTHREAD = @LIBPTHREAD@
+LIBS = @LIBS@
+LIBSOCKET = @LIBSOCKET@
+LIBSTDTHREAD = @LIBSTDTHREAD@
+LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@
+LIBTHREAD = @LIBTHREAD@
+LIBTOOL = @LIBTOOL@
+LIB_BLKID = @LIB_BLKID@
+LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
+LIB_GETRANDOM = @LIB_GETRANDOM@
+LIB_HARD_LOCALE = @LIB_HARD_LOCALE@
+LIB_MBRTOWC = @LIB_MBRTOWC@
+LIB_NANOSLEEP = @LIB_NANOSLEEP@
+LIB_NL_LANGINFO = @LIB_NL_LANGINFO@
+LIB_PTHREAD = @LIB_PTHREAD@
+LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@
+LIB_SCHED_YIELD = @LIB_SCHED_YIELD@
+LIB_SELECT = @LIB_SELECT@
+LIB_SEMAPHORE = @LIB_SEMAPHORE@
+LIB_SETLOCALE = @LIB_SETLOCALE@
+LIB_SETLOCALE_NULL = @LIB_SETLOCALE_NULL@
+LIMITS_H = @LIMITS_H@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
+LOCALENAME_ENHANCE_LOCALE_FUNCS = @LOCALENAME_ENHANCE_LOCALE_FUNCS@
+LOCALE_FR = @LOCALE_FR@
+LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@
+LOCALE_JA = @LOCALE_JA@
+LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@
+LOCALE_ZH_CN = @LOCALE_ZH_CN@
+LTALLOCA = @LTALLOCA@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
+LTLIBOBJS = @LTLIBOBJS@
+LTLIBTHREAD = @LTLIBTHREAD@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MBRTOWC_LIB = @MBRTOWC_LIB@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NANOSLEEP_LIB = @NANOSLEEP_LIB@
+NETINET_IN_H = @NETINET_IN_H@
+NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@
+NEXT_ASSERT_H = @NEXT_ASSERT_H@
+NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@
+NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@
+NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_CTYPE_H@
+NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@
+NEXT_AS_FIRST_DIRECTIVE_ERROR_H = @NEXT_AS_FIRST_DIRECTIVE_ERROR_H@
+NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@
+NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@
+NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@
+NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@
+NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@
+NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@
+NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H = @NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H@
+NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H = @NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H@
+NEXT_AS_FIRST_DIRECTIVE_SCHED_H = @NEXT_AS_FIRST_DIRECTIVE_SCHED_H@
+NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@
+NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@
+NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
+NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
+NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@
+NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
+NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@
+NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@
+NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
+NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@
+NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@
+NEXT_CTYPE_H = @NEXT_CTYPE_H@
+NEXT_ERRNO_H = @NEXT_ERRNO_H@
+NEXT_ERROR_H = @NEXT_ERROR_H@
+NEXT_FCNTL_H = @NEXT_FCNTL_H@
+NEXT_GETOPT_H = @NEXT_GETOPT_H@
+NEXT_INTTYPES_H = @NEXT_INTTYPES_H@
+NEXT_LANGINFO_H = @NEXT_LANGINFO_H@
+NEXT_LIMITS_H = @NEXT_LIMITS_H@
+NEXT_LOCALE_H = @NEXT_LOCALE_H@
+NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
+NEXT_PTHREAD_H = @NEXT_PTHREAD_H@
+NEXT_SCHED_H = @NEXT_SCHED_H@
+NEXT_SIGNAL_H = @NEXT_SIGNAL_H@
+NEXT_STDARG_H = @NEXT_STDARG_H@
+NEXT_STDDEF_H = @NEXT_STDDEF_H@
+NEXT_STDINT_H = @NEXT_STDINT_H@
+NEXT_STDIO_H = @NEXT_STDIO_H@
+NEXT_STDLIB_H = @NEXT_STDLIB_H@
+NEXT_STRING_H = @NEXT_STRING_H@
+NEXT_SYS_IOCTL_H = @NEXT_SYS_IOCTL_H@
+NEXT_SYS_RANDOM_H = @NEXT_SYS_RANDOM_H@
+NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@
+NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
+NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
+NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
+NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@
+NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@
+NEXT_TIME_H = @NEXT_TIME_H@
+NEXT_UNISTD_H = @NEXT_UNISTD_H@
+NEXT_WCHAR_H = @NEXT_WCHAR_H@
+NEXT_WCTYPE_H = @NEXT_WCTYPE_H@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OS = @OS@
+OS_LIBS = @OS_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PARTEDLDFLAGS = @PARTEDLDFLAGS@
+PARTED_LIBS = @PARTED_LIBS@
+PARTED_USABLE_TEST_DIR = @PARTED_USABLE_TEST_DIR@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POSUB = @POSUB@
+PRAGMA_COLUMNS = @PRAGMA_COLUMNS@
+PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@
+PRIPTR_PREFIX = @PRIPTR_PREFIX@
+PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
+PTHREAD_SIGMASK_LIB = @PTHREAD_SIGMASK_LIB@
+PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
+RANLIB = @RANLIB@
+REPLACE_ACCESS = @REPLACE_ACCESS@
+REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@
+REPLACE_BTOWC = @REPLACE_BTOWC@
+REPLACE_CALLOC_FOR_CALLOC_GNU = @REPLACE_CALLOC_FOR_CALLOC_GNU@
+REPLACE_CALLOC_FOR_CALLOC_POSIX = @REPLACE_CALLOC_FOR_CALLOC_POSIX@
+REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
+REPLACE_CHMOD = @REPLACE_CHMOD@
+REPLACE_CHOWN = @REPLACE_CHOWN@
+REPLACE_CLOSE = @REPLACE_CLOSE@
+REPLACE_COPY_FILE_RANGE = @REPLACE_COPY_FILE_RANGE@
+REPLACE_CREAT = @REPLACE_CREAT@
+REPLACE_CTIME = @REPLACE_CTIME@
+REPLACE_DPRINTF = @REPLACE_DPRINTF@
+REPLACE_DUP = @REPLACE_DUP@
+REPLACE_DUP2 = @REPLACE_DUP2@
+REPLACE_DUP3 = @REPLACE_DUP3@
+REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@
+REPLACE_ERROR = @REPLACE_ERROR@
+REPLACE_ERROR_AT_LINE = @REPLACE_ERROR_AT_LINE@
+REPLACE_EXECL = @REPLACE_EXECL@
+REPLACE_EXECLE = @REPLACE_EXECLE@
+REPLACE_EXECLP = @REPLACE_EXECLP@
+REPLACE_EXECV = @REPLACE_EXECV@
+REPLACE_EXECVE = @REPLACE_EXECVE@
+REPLACE_EXECVP = @REPLACE_EXECVP@
+REPLACE_EXECVPE = @REPLACE_EXECVPE@
+REPLACE_FACCESSAT = @REPLACE_FACCESSAT@
+REPLACE_FCHMODAT = @REPLACE_FCHMODAT@
+REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@
+REPLACE_FCLOSE = @REPLACE_FCLOSE@
+REPLACE_FCNTL = @REPLACE_FCNTL@
+REPLACE_FDATASYNC = @REPLACE_FDATASYNC@
+REPLACE_FDOPEN = @REPLACE_FDOPEN@
+REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FFSLL = @REPLACE_FFSLL@
+REPLACE_FOPEN = @REPLACE_FOPEN@
+REPLACE_FOPEN_FOR_FOPEN_GNU = @REPLACE_FOPEN_FOR_FOPEN_GNU@
+REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FPURGE = @REPLACE_FPURGE@
+REPLACE_FREE = @REPLACE_FREE@
+REPLACE_FREELOCALE = @REPLACE_FREELOCALE@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
+REPLACE_FSEEK = @REPLACE_FSEEK@
+REPLACE_FSEEKO = @REPLACE_FSEEKO@
+REPLACE_FSTAT = @REPLACE_FSTAT@
+REPLACE_FSTATAT = @REPLACE_FSTATAT@
+REPLACE_FTELL = @REPLACE_FTELL@
+REPLACE_FTELLO = @REPLACE_FTELLO@
+REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@
+REPLACE_FUTIMENS = @REPLACE_FUTIMENS@
+REPLACE_GETCWD = @REPLACE_GETCWD@
+REPLACE_GETDELIM = @REPLACE_GETDELIM@
+REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@
+REPLACE_GETDTABLESIZE = @REPLACE_GETDTABLESIZE@
+REPLACE_GETENTROPY = @REPLACE_GETENTROPY@
+REPLACE_GETGROUPS = @REPLACE_GETGROUPS@
+REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETLOADAVG = @REPLACE_GETLOADAVG@
+REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
+REPLACE_GETPASS = @REPLACE_GETPASS@
+REPLACE_GETPASS_FOR_GETPASS_GNU = @REPLACE_GETPASS_FOR_GETPASS_GNU@
+REPLACE_GETPROGNAME = @REPLACE_GETPROGNAME@
+REPLACE_GETRANDOM = @REPLACE_GETRANDOM@
+REPLACE_GETSUBOPT = @REPLACE_GETSUBOPT@
+REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
+REPLACE_GMTIME = @REPLACE_GMTIME@
+REPLACE_IMAXABS = @REPLACE_IMAXABS@
+REPLACE_IMAXDIV = @REPLACE_IMAXDIV@
+REPLACE_INET_NTOP = @REPLACE_INET_NTOP@
+REPLACE_INET_PTON = @REPLACE_INET_PTON@
+REPLACE_INITSTATE = @REPLACE_INITSTATE@
+REPLACE_IOCTL = @REPLACE_IOCTL@
+REPLACE_ISATTY = @REPLACE_ISATTY@
+REPLACE_ISWBLANK = @REPLACE_ISWBLANK@
+REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@
+REPLACE_ISWDIGIT = @REPLACE_ISWDIGIT@
+REPLACE_ISWXDIGIT = @REPLACE_ISWXDIGIT@
+REPLACE_LCHOWN = @REPLACE_LCHOWN@
+REPLACE_LINK = @REPLACE_LINK@
+REPLACE_LINKAT = @REPLACE_LINKAT@
+REPLACE_LOCALECONV = @REPLACE_LOCALECONV@
+REPLACE_LOCALTIME = @REPLACE_LOCALTIME@
+REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
+REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_LSTAT = @REPLACE_LSTAT@
+REPLACE_MALLOC_FOR_MALLOC_GNU = @REPLACE_MALLOC_FOR_MALLOC_GNU@
+REPLACE_MALLOC_FOR_MALLOC_POSIX = @REPLACE_MALLOC_FOR_MALLOC_POSIX@
+REPLACE_MBRLEN = @REPLACE_MBRLEN@
+REPLACE_MBRTOWC = @REPLACE_MBRTOWC@
+REPLACE_MBSINIT = @REPLACE_MBSINIT@
+REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@
+REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@
+REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@
+REPLACE_MBTOWC = @REPLACE_MBTOWC@
+REPLACE_MEMCHR = @REPLACE_MEMCHR@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
+REPLACE_MEMPCPY = @REPLACE_MEMPCPY@
+REPLACE_MKDIR = @REPLACE_MKDIR@
+REPLACE_MKFIFO = @REPLACE_MKFIFO@
+REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@
+REPLACE_MKNOD = @REPLACE_MKNOD@
+REPLACE_MKNODAT = @REPLACE_MKNODAT@
+REPLACE_MKOSTEMP = @REPLACE_MKOSTEMP@
+REPLACE_MKOSTEMPS = @REPLACE_MKOSTEMPS@
+REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
+REPLACE_MKTIME = @REPLACE_MKTIME@
+REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
+REPLACE_NEWLOCALE = @REPLACE_NEWLOCALE@
+REPLACE_NL_LANGINFO = @REPLACE_NL_LANGINFO@
+REPLACE_NULL = @REPLACE_NULL@
+REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@
+REPLACE_OPEN = @REPLACE_OPEN@
+REPLACE_OPENAT = @REPLACE_OPENAT@
+REPLACE_PERROR = @REPLACE_PERROR@
+REPLACE_PIPE2 = @REPLACE_PIPE2@
+REPLACE_POPEN = @REPLACE_POPEN@
+REPLACE_POSIX_MEMALIGN = @REPLACE_POSIX_MEMALIGN@
+REPLACE_POSIX_OPENPT = @REPLACE_POSIX_OPENPT@
+REPLACE_PREAD = @REPLACE_PREAD@
+REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PSELECT = @REPLACE_PSELECT@
+REPLACE_PTHREAD_ATTR_DESTROY = @REPLACE_PTHREAD_ATTR_DESTROY@
+REPLACE_PTHREAD_ATTR_GETDETACHSTATE = @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
+REPLACE_PTHREAD_ATTR_INIT = @REPLACE_PTHREAD_ATTR_INIT@
+REPLACE_PTHREAD_ATTR_SETDETACHSTATE = @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
+REPLACE_PTHREAD_CONDATTR_DESTROY = @REPLACE_PTHREAD_CONDATTR_DESTROY@
+REPLACE_PTHREAD_CONDATTR_INIT = @REPLACE_PTHREAD_CONDATTR_INIT@
+REPLACE_PTHREAD_COND_BROADCAST = @REPLACE_PTHREAD_COND_BROADCAST@
+REPLACE_PTHREAD_COND_DESTROY = @REPLACE_PTHREAD_COND_DESTROY@
+REPLACE_PTHREAD_COND_INIT = @REPLACE_PTHREAD_COND_INIT@
+REPLACE_PTHREAD_COND_SIGNAL = @REPLACE_PTHREAD_COND_SIGNAL@
+REPLACE_PTHREAD_COND_TIMEDWAIT = @REPLACE_PTHREAD_COND_TIMEDWAIT@
+REPLACE_PTHREAD_COND_WAIT = @REPLACE_PTHREAD_COND_WAIT@
+REPLACE_PTHREAD_CREATE = @REPLACE_PTHREAD_CREATE@
+REPLACE_PTHREAD_DETACH = @REPLACE_PTHREAD_DETACH@
+REPLACE_PTHREAD_EQUAL = @REPLACE_PTHREAD_EQUAL@
+REPLACE_PTHREAD_EXIT = @REPLACE_PTHREAD_EXIT@
+REPLACE_PTHREAD_GETSPECIFIC = @REPLACE_PTHREAD_GETSPECIFIC@
+REPLACE_PTHREAD_JOIN = @REPLACE_PTHREAD_JOIN@
+REPLACE_PTHREAD_KEY_CREATE = @REPLACE_PTHREAD_KEY_CREATE@
+REPLACE_PTHREAD_KEY_DELETE = @REPLACE_PTHREAD_KEY_DELETE@
+REPLACE_PTHREAD_MUTEXATTR_DESTROY = @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
+REPLACE_PTHREAD_MUTEXATTR_GETROBUST = @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
+REPLACE_PTHREAD_MUTEXATTR_GETTYPE = @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
+REPLACE_PTHREAD_MUTEXATTR_INIT = @REPLACE_PTHREAD_MUTEXATTR_INIT@
+REPLACE_PTHREAD_MUTEXATTR_SETROBUST = @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
+REPLACE_PTHREAD_MUTEXATTR_SETTYPE = @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
+REPLACE_PTHREAD_MUTEX_DESTROY = @REPLACE_PTHREAD_MUTEX_DESTROY@
+REPLACE_PTHREAD_MUTEX_INIT = @REPLACE_PTHREAD_MUTEX_INIT@
+REPLACE_PTHREAD_MUTEX_LOCK = @REPLACE_PTHREAD_MUTEX_LOCK@
+REPLACE_PTHREAD_MUTEX_TIMEDLOCK = @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
+REPLACE_PTHREAD_MUTEX_TRYLOCK = @REPLACE_PTHREAD_MUTEX_TRYLOCK@
+REPLACE_PTHREAD_MUTEX_UNLOCK = @REPLACE_PTHREAD_MUTEX_UNLOCK@
+REPLACE_PTHREAD_ONCE = @REPLACE_PTHREAD_ONCE@
+REPLACE_PTHREAD_RWLOCKATTR_DESTROY = @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
+REPLACE_PTHREAD_RWLOCKATTR_INIT = @REPLACE_PTHREAD_RWLOCKATTR_INIT@
+REPLACE_PTHREAD_RWLOCK_DESTROY = @REPLACE_PTHREAD_RWLOCK_DESTROY@
+REPLACE_PTHREAD_RWLOCK_INIT = @REPLACE_PTHREAD_RWLOCK_INIT@
+REPLACE_PTHREAD_RWLOCK_RDLOCK = @REPLACE_PTHREAD_RWLOCK_RDLOCK@
+REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
+REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
+REPLACE_PTHREAD_RWLOCK_TRYRDLOCK = @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
+REPLACE_PTHREAD_RWLOCK_TRYWRLOCK = @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
+REPLACE_PTHREAD_RWLOCK_UNLOCK = @REPLACE_PTHREAD_RWLOCK_UNLOCK@
+REPLACE_PTHREAD_RWLOCK_WRLOCK = @REPLACE_PTHREAD_RWLOCK_WRLOCK@
+REPLACE_PTHREAD_SELF = @REPLACE_PTHREAD_SELF@
+REPLACE_PTHREAD_SETSPECIFIC = @REPLACE_PTHREAD_SETSPECIFIC@
+REPLACE_PTHREAD_SIGMASK = @REPLACE_PTHREAD_SIGMASK@
+REPLACE_PTHREAD_SPIN_DESTROY = @REPLACE_PTHREAD_SPIN_DESTROY@
+REPLACE_PTHREAD_SPIN_INIT = @REPLACE_PTHREAD_SPIN_INIT@
+REPLACE_PTHREAD_SPIN_LOCK = @REPLACE_PTHREAD_SPIN_LOCK@
+REPLACE_PTHREAD_SPIN_TRYLOCK = @REPLACE_PTHREAD_SPIN_TRYLOCK@
+REPLACE_PTHREAD_SPIN_UNLOCK = @REPLACE_PTHREAD_SPIN_UNLOCK@
+REPLACE_PTSNAME = @REPLACE_PTSNAME@
+REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@
+REPLACE_PUTENV = @REPLACE_PUTENV@
+REPLACE_PWRITE = @REPLACE_PWRITE@
+REPLACE_QSORT_R = @REPLACE_QSORT_R@
+REPLACE_RAISE = @REPLACE_RAISE@
+REPLACE_RANDOM = @REPLACE_RANDOM@
+REPLACE_RANDOM_R = @REPLACE_RANDOM_R@
+REPLACE_READ = @REPLACE_READ@
+REPLACE_READLINK = @REPLACE_READLINK@
+REPLACE_READLINKAT = @REPLACE_READLINKAT@
+REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@
+REPLACE_REALLOC_FOR_REALLOC_GNU = @REPLACE_REALLOC_FOR_REALLOC_GNU@
+REPLACE_REALLOC_FOR_REALLOC_POSIX = @REPLACE_REALLOC_FOR_REALLOC_POSIX@
+REPLACE_REALPATH = @REPLACE_REALPATH@
+REPLACE_REMOVE = @REPLACE_REMOVE@
+REPLACE_RENAME = @REPLACE_RENAME@
+REPLACE_RENAMEAT = @REPLACE_RENAMEAT@
+REPLACE_RMDIR = @REPLACE_RMDIR@
+REPLACE_SCHED_YIELD = @REPLACE_SCHED_YIELD@
+REPLACE_SELECT = @REPLACE_SELECT@
+REPLACE_SETENV = @REPLACE_SETENV@
+REPLACE_SETHOSTNAME = @REPLACE_SETHOSTNAME@
+REPLACE_SETLOCALE = @REPLACE_SETLOCALE@
+REPLACE_SETSTATE = @REPLACE_SETSTATE@
+REPLACE_SLEEP = @REPLACE_SLEEP@
+REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
+REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STAT = @REPLACE_STAT@
+REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@
+REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@
+REPLACE_STPCPY = @REPLACE_STPCPY@
+REPLACE_STPNCPY = @REPLACE_STPNCPY@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@
+REPLACE_STRDUP = @REPLACE_STRDUP@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@
+REPLACE_STRERROR_R = @REPLACE_STRERROR_R@
+REPLACE_STRFTIME = @REPLACE_STRFTIME@
+REPLACE_STRNCAT = @REPLACE_STRNCAT@
+REPLACE_STRNDUP = @REPLACE_STRNDUP@
+REPLACE_STRNLEN = @REPLACE_STRNLEN@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
+REPLACE_STRTOD = @REPLACE_STRTOD@
+REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@
+REPLACE_STRTOK_R = @REPLACE_STRTOK_R@
+REPLACE_STRTOL = @REPLACE_STRTOL@
+REPLACE_STRTOLD = @REPLACE_STRTOLD@
+REPLACE_STRTOLL = @REPLACE_STRTOLL@
+REPLACE_STRTOUL = @REPLACE_STRTOUL@
+REPLACE_STRTOULL = @REPLACE_STRTOULL@
+REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@
+REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@
+REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@
+REPLACE_SYMLINK = @REPLACE_SYMLINK@
+REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@
+REPLACE_TIME = @REPLACE_TIME@
+REPLACE_TIMEGM = @REPLACE_TIMEGM@
+REPLACE_TIMESPEC_GET = @REPLACE_TIMESPEC_GET@
+REPLACE_TMPFILE = @REPLACE_TMPFILE@
+REPLACE_TOWLOWER = @REPLACE_TOWLOWER@
+REPLACE_TRUNCATE = @REPLACE_TRUNCATE@
+REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@
+REPLACE_TZSET = @REPLACE_TZSET@
+REPLACE_UNLINK = @REPLACE_UNLINK@
+REPLACE_UNLINKAT = @REPLACE_UNLINKAT@
+REPLACE_UNSETENV = @REPLACE_UNSETENV@
+REPLACE_USLEEP = @REPLACE_USLEEP@
+REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@
+REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
+REPLACE_VDPRINTF = @REPLACE_VDPRINTF@
+REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
+REPLACE_VPRINTF = @REPLACE_VPRINTF@
+REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
+REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
+REPLACE_WCRTOMB = @REPLACE_WCRTOMB@
+REPLACE_WCSFTIME = @REPLACE_WCSFTIME@
+REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@
+REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@
+REPLACE_WCSTOK = @REPLACE_WCSTOK@
+REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@
+REPLACE_WCTOB = @REPLACE_WCTOB@
+REPLACE_WCTOMB = @REPLACE_WCTOMB@
+REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
+REPLACE_WMEMPCPY = @REPLACE_WMEMPCPY@
+REPLACE_WRITE = @REPLACE_WRITE@
+REPLACE__EXIT = @REPLACE__EXIT@
+SCHED_YIELD_LIB = @SCHED_YIELD_LIB@
+SED = @SED@
+SELECT_LIB = @SELECT_LIB@
+SETLOCALE_LIB = @SETLOCALE_LIB@
+SETLOCALE_NULL_LIB = @SETLOCALE_NULL_LIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
+SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
+STDARG_H = @STDARG_H@
+STDCKDINT_H = @STDCKDINT_H@
+STDDEF_H = @STDDEF_H@
+STDINT_H = @STDINT_H@
+STRIP = @STRIP@
+SYS_IOCTL_H_HAVE_WINSOCK2_H = @SYS_IOCTL_H_HAVE_WINSOCK2_H@
+SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
+SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
+TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
+TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@
+UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@
+UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@
+UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
+UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@
+UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
+UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
+USE_NLS = @USE_NLS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
+WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@
+WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@
+WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@
+WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@
+WINT_T_SUFFIX = @WINT_T_SUFFIX@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+YIELD_LIB = @YIELD_LIB@
+abs_aux_dir = @abs_aux_dir@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+bindir_c = @bindir_c@
+bindir_c_make = @bindir_c_make@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datadir_c = @datadir_c@
+datadir_c_make = @datadir_c_make@
+datarootdir = @datarootdir@
+datarootdir_c = @datarootdir_c@
+datarootdir_c_make = @datarootdir_c_make@
+docdir = @docdir@
+docdir_c = @docdir_c@
+docdir_c_make = @docdir_c_make@
+dvidir = @dvidir@
+dvidir_c = @dvidir_c@
+dvidir_c_make = @dvidir_c_make@
+exec_prefix = @exec_prefix@
+exec_prefix_c = @exec_prefix_c@
+exec_prefix_c_make = @exec_prefix_c_make@
+gl_LIBOBJDEPS = @gl_LIBOBJDEPS@
+gl_LIBOBJS = @gl_LIBOBJS@
+gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJDEPS = @gltests_LIBOBJDEPS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
+gltests_WITNESS = @gltests_WITNESS@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+htmldir_c = @htmldir_c@
+htmldir_c_make = @htmldir_c_make@
+includedir = @includedir@
+includedir_c = @includedir_c@
+includedir_c_make = @includedir_c_make@
+infodir = @infodir@
+infodir_c = @infodir_c@
+infodir_c_make = @infodir_c_make@
+install_sh = @install_sh@
+libdir = @libdir@
+libdir_c = @libdir_c@
+libdir_c_make = @libdir_c_make@
+libexecdir = @libexecdir@
+libexecdir_c = @libexecdir_c@
+libexecdir_c_make = @libexecdir_c_make@
+lispdir = @lispdir@
+lispdir_c = @lispdir_c@
+lispdir_c_make = @lispdir_c_make@
+localedir = @localedir@
+localedir_c = @localedir_c@
+localedir_c_make = @localedir_c_make@
+localstatedir = @localstatedir@
+localstatedir_c = @localstatedir_c@
+localstatedir_c_make = @localstatedir_c_make@
+mandir = @mandir@
+mandir_c = @mandir_c@
+mandir_c_make = @mandir_c_make@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+oldincludedir_c = @oldincludedir_c@
+oldincludedir_c_make = @oldincludedir_c_make@
+pdfdir = @pdfdir@
+pdfdir_c = @pdfdir_c@
+pdfdir_c_make = @pdfdir_c_make@
+pkgdatadir_c = @pkgdatadir_c@
+pkgdatadir_c_make = @pkgdatadir_c_make@
+pkgincludedir_c = @pkgincludedir_c@
+pkgincludedir_c_make = @pkgincludedir_c_make@
+pkglibdir_c = @pkglibdir_c@
+pkglibdir_c_make = @pkglibdir_c_make@
+pkglibexecdir_c = @pkglibexecdir_c@
+pkglibexecdir_c_make = @pkglibexecdir_c_make@
+prefix = @prefix@
+prefix_c = @prefix_c@
+prefix_c_make = @prefix_c_make@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+psdir_c = @psdir_c@
+psdir_c_make = @psdir_c_make@
+runstatedir = @runstatedir@
+runstatedir_c = @runstatedir_c@
+runstatedir_c_make = @runstatedir_c_make@
+sbindir = @sbindir@
+sbindir_c = @sbindir_c@
+sbindir_c_make = @sbindir_c_make@
+sharedstatedir = @sharedstatedir@
+sharedstatedir_c = @sharedstatedir_c@
+sharedstatedir_c_make = @sharedstatedir_c_make@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+sysconfdir_c = @sysconfdir_c@
+sysconfdir_c_make = @sysconfdir_c_make@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+TESTS = \
+ help-version.sh \
+ t0000-basic.sh \
+ t0001-tiny.sh \
+ t0010-script-no-ctrl-chars.sh \
+ t0100-print.sh \
+ t0101-print-empty.sh \
+ t0200-gpt.sh \
+ t0201-gpt.sh \
+ t0202-gpt-pmbr.sh \
+ t0203-gpt-tiny-device-abort.sh \
+ t0203-gpt-shortened-device-primary-valid.sh \
+ t0203-gpt-create-on-min-sized-device.sh \
+ t0205-gpt-list-clobbers-pmbr.sh \
+ t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh \
+ t0207-IEC-binary-notation.sh \
+ t0208-mkpart-end-in-IEC.sh \
+ t0209-gpt-pmbr_boot.sh \
+ t0210-gpt-resized-partition-entry-array.sh \
+ t0211-gpt-rewrite-header.sh \
+ t0212-gpt-many-partitions.sh \
+ t0213-mkpart-start-negative.sh \
+ t0215-gpt-attrs.sh \
+ t0220-gpt-msftres.sh \
+ t0250-gpt.sh \
+ t0251-gpt-unicode.sh \
+ t0280-gpt-corrupt.sh \
+ t0281-gpt-grow.sh \
+ t0282-gpt-move-backup.sh \
+ t0283-overlap-partitions.sh \
+ t0290-gpt-name.sh \
+ t0300-dos-on-gpt.sh \
+ t0301-overwrite-gpt-pmbr.sh \
+ t0350-mac-PT-increases-sector-size.sh \
+ t0400-loop-clobber-infloop.sh \
+ t0500-dup-clobber.sh \
+ t0501-duplicate.sh \
+ t0800-json-gpt.sh \
+ t0801-json-msdos.sh \
+ t0900-type-gpt.sh \
+ t0901-type-gpt-invalid.sh \
+ t0910-type-dos.sh \
+ t0911-type-dos-invalid.sh \
+ t1100-busy-label.sh \
+ t1101-busy-partition.sh \
+ t1102-loop-label.sh \
+ t1104-remove-and-add-partition.sh \
+ t1700-probe-fs.sh \
+ t1701-rescue-fs.sh \
+ t2200-dos-label-recog.sh \
+ t2201-pc98-label-recog.sh \
+ t2300-dos-label-extended-bootcode.sh \
+ t2310-dos-extended-2-sector-min-offset.sh \
+ t2320-dos-extended-noclobber.sh \
+ t2400-dos-hfs-partition-type.sh \
+ t2410-dos-udf-partition-type.sh \
+ t2500-probe-corrupt-hfs.sh \
+ t3000-resize-fs.sh \
+ t3200-resize-partition.sh \
+ t3200-type-change.sh \
+ t3210-gpt-type-change.sh \
+ t3300-palo-prep.sh \
+ t3310-flags.sh \
+ t3400-whole-disk-FAT-partition.sh \
+ t4000-sun-raid-type.sh \
+ t4001-sun-vtoc.sh \
+ t4100-msdos-partition-limits.sh \
+ t4100-dvh-partition-limits.sh \
+ t4100-msdos-starting-sector.sh \
+ t4200-partprobe.sh \
+ t4300-nilfs2-tiny.sh \
+ t4301-nilfs2-badsb2.sh \
+ t4302-nilfs2-lessbadsb2.sh \
+ t5000-tags.sh \
+ t6000-dm.sh \
+ t6001-psep.sh \
+ t6002-dm-busy.sh \
+ t6003-dm-hide.sh \
+ t6004-dm-many-partitions.sh \
+ t6005-dm-uuid.sh \
+ t6006-dm-512b-sectors.sh \
+ t6100-mdraid-partitions.sh \
+ t7000-scripting.sh \
+ t8000-loop.sh \
+ t8001-loop-blkpg.sh \
+ t9010-big-sector.sh \
+ t9020-alignment.sh \
+ t9021-maxima.sh \
+ t9022-one-unit-snap.sh \
+ t9023-value-lt-one.sh \
+ t9024-msdos-1s-partition.sh \
+ t9025-gpt-1s-partition.sh \
+ t9030-align-check.sh \
+ t9040-many-partitions.sh \
+ t9041-undetected-in-use-16th-partition.sh \
+ t9042-dos-partition-limit.sh \
+ t9050-partition-table-types.sh \
+ t9060-gpt-grow-script-fix.sh
+
+EXTRA_DIST = \
+ $(TESTS) t-local.sh t-lvm.sh \
+ init.cfg init.sh t-lib-helpers.sh gpt-header-munge \
+ gpt-header-move msdos-overlap gpt-attrs
+
+fs_resize_LDADD = \
+ $(top_builddir)/libparted/fs/libparted-fs-resize.la \
+ $(top_builddir)/libparted/libparted.la
+
+LDADD = \
+ $(top_builddir)/libparted/libparted.la
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/lib \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include
+
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+parted_dir = $(abs_top_builddir)/parted
+pp_dir = $(abs_top_builddir)/partprobe
+sep = $(PATH_SEPARATOR)
+
+# Note that the first lines are statements. They ensure that environment
+# variables that can perturb tests are unset or set to expected values.
+# The rest are envvar settings that propagate build-related Makefile
+# variables to test scripts.
+TESTS_ENVIRONMENT = \
+ tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
+ TMPDIR=$$tmp__; export TMPDIR; \
+ export \
+ abs_top_builddir='$(abs_top_builddir)' \
+ abs_top_srcdir='$(abs_top_srcdir)' \
+ abs_srcdir='$(abs_srcdir)' \
+ built_programs=parted \
+ srcdir='$(srcdir)' \
+ top_srcdir='$(top_srcdir)' \
+ AWK='$(AWK)' \
+ PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)' \
+ PACKAGE_VERSION=$(PACKAGE_VERSION) \
+ CONFIG_HEADER='$(abs_top_builddir)/lib/config.h' \
+ ENABLE_DEVICE_MAPPER=$(ENABLE_DEVICE_MAPPER) \
+ PARTED_TEST_NAME=`basename '$(abs_srcdir)'`,`echo $$tst|sed 's,^\./,,;s,/,-,g'`\
+ PATH='$(abs_top_builddir)/parted$(PATH_SEPARATOR)'"$$PATH" \
+ VERSION=$(VERSION) \
+ ; 9>&2
+
+VERBOSE = yes
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .sh .sh$(EXEEXT) .trs
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu tests/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+dup-clobber$(EXEEXT): $(dup_clobber_OBJECTS) $(dup_clobber_DEPENDENCIES) $(EXTRA_dup_clobber_DEPENDENCIES)
+ @rm -f dup-clobber$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(dup_clobber_OBJECTS) $(dup_clobber_LDADD) $(LIBS)
+
+duplicate$(EXEEXT): $(duplicate_OBJECTS) $(duplicate_DEPENDENCIES) $(EXTRA_duplicate_DEPENDENCIES)
+ @rm -f duplicate$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(duplicate_OBJECTS) $(duplicate_LDADD) $(LIBS)
+
+fs-resize$(EXEEXT): $(fs_resize_OBJECTS) $(fs_resize_DEPENDENCIES) $(EXTRA_fs_resize_DEPENDENCIES)
+ @rm -f fs-resize$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(fs_resize_OBJECTS) $(fs_resize_LDADD) $(LIBS)
+
+print-align$(EXEEXT): $(print_align_OBJECTS) $(print_align_DEPENDENCIES) $(EXTRA_print_align_DEPENDENCIES)
+ @rm -f print-align$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(print_align_OBJECTS) $(print_align_LDADD) $(LIBS)
+
+print-flags$(EXEEXT): $(print_flags_OBJECTS) $(print_flags_DEPENDENCIES) $(EXTRA_print_flags_DEPENDENCIES)
+ @rm -f print-flags$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(print_flags_OBJECTS) $(print_flags_LDADD) $(LIBS)
+
+print-max$(EXEEXT): $(print_max_OBJECTS) $(print_max_DEPENDENCIES) $(EXTRA_print_max_DEPENDENCIES)
+ @rm -f print-max$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(print_max_OBJECTS) $(print_max_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup-clobber.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/duplicate.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs-resize.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-align.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-flags.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-max.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS: $(check_PROGRAMS)
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+.sh.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.sh$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/dup-clobber.Po
+ -rm -f ./$(DEPDIR)/duplicate.Po
+ -rm -f ./$(DEPDIR)/fs-resize.Po
+ -rm -f ./$(DEPDIR)/print-align.Po
+ -rm -f ./$(DEPDIR)/print-flags.Po
+ -rm -f ./$(DEPDIR)/print-max.Po
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/dup-clobber.Po
+ -rm -f ./$(DEPDIR)/duplicate.Po
+ -rm -f ./$(DEPDIR)/fs-resize.Po
+ -rm -f ./$(DEPDIR)/print-align.Po
+ -rm -f ./$(DEPDIR)/print-flags.Po
+ -rm -f ./$(DEPDIR)/print-max.Po
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
+ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/dup-clobber.c b/tests/dup-clobber.c
new file mode 100644
index 0000000..4e7add2
--- /dev/null
+++ b/tests/dup-clobber.c
@@ -0,0 +1,103 @@
+/* Demonstrate that setting disk->needs_clobber in ped_disk_duplicate
+ is necessary. With that, this test passes. Without it, the last
+ sectors of the disk are cleared, and this test fails. */
+#include <config.h>
+#include <parted/parted.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "closeout.h"
+#include "progname.h"
+
+static void
+seek_to_final_sector (int fd, PedSector ss)
+{
+ /* Seek to EOF. */
+ off_t off = lseek (fd, 0, SEEK_END);
+
+ /* That had better succeed and determine that the size is > 2 sectors
+ and an exact multiple of ss. */
+ assert (2 * ss < off);
+ assert (off % ss == 0);
+
+ /* Back up one sector. */
+ off = lseek (fd, -ss, SEEK_CUR);
+ assert (0 < off);
+}
+
+static void
+scribble_on_final_sector (char const *file_name, PedSector ss)
+{
+ assert (0 < ss);
+ assert (ss % 512 == 0);
+ int fd = open (file_name, O_WRONLY);
+ assert (0 <= fd);
+
+ seek_to_final_sector (fd, ss);
+
+ /* Fill the final sector with ascii 'G's. */
+ char *buf = malloc (ss);
+ assert (buf);
+ memset (buf, 'G', ss);
+ assert (write (fd, buf, ss) == ss);
+ free (buf);
+ assert (close (fd) == 0);
+}
+
+int
+main (int argc, char **argv)
+{
+ atexit (close_stdout);
+ set_program_name (argv[0]);
+
+ if (argc != 1)
+ return EXIT_FAILURE;
+
+ char const *dev_name = "dev-file";
+
+ /* Create a file. */
+ int fd = open (dev_name, O_CREAT|O_TRUNC|O_WRONLY, 0644);
+ assert (0 <= fd);
+ off_t size = 8 * 1024 * 1024;
+ assert (ftruncate (fd, size) == 0);
+ assert (close (fd) == 0);
+
+ PedDevice *dev = ped_device_get (dev_name);
+ assert (dev);
+
+ PedDisk *disk = ped_disk_new_fresh (dev, ped_disk_type_get ("msdos"));
+ assert (disk);
+
+ assert (ped_disk_commit(disk));
+
+ PedSector ss = dev->sector_size;
+ scribble_on_final_sector (dev_name, ss);
+
+ /* Before the fix, this ped_disk_duplicate call would always set
+ copy->needs_clobber, thus causing the subsequent commit to
+ mistakenly clobber 9KiB at each end of the disk. */
+ PedDisk *copy = ped_disk_duplicate (disk);
+ assert (ped_disk_commit(copy));
+
+ ped_disk_destroy (copy);
+ ped_disk_destroy (disk);
+ ped_device_destroy (dev);
+
+ /* Read the final sector and ensure it's still all 'G's. */
+ fd = open (dev_name, O_RDONLY);
+ assert (0 <= fd);
+ seek_to_final_sector (fd, ss);
+ char *buf = malloc (ss);
+ assert (buf);
+ assert (read (fd, buf, ss) == ss);
+ unsigned int i;
+ for (i = 0; i < ss; i++)
+ assert (buf[i] == 'G');
+ free (buf);
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/duplicate.c b/tests/duplicate.c
new file mode 100644
index 0000000..129875e
--- /dev/null
+++ b/tests/duplicate.c
@@ -0,0 +1,159 @@
+/* Demonstrate that ped_disk_duplicate is working correctly.
+*/
+#include <config.h>
+#include <parted/parted.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include "closeout.h"
+#include "progname.h"
+
+int
+main (int argc, char **argv)
+{
+ atexit (close_stdout);
+ set_program_name (argv[0]);
+
+ if (argc != 2)
+ return EXIT_FAILURE;
+
+ char const *dev_name = "dev-file";
+
+ /* Create a file. */
+ int fd = open (dev_name, O_CREAT|O_TRUNC|O_WRONLY, 0644);
+ assert (0 <= fd);
+ off_t size = 32 * 1024 * 1024;
+ assert (ftruncate (fd, size) == 0);
+ assert (close (fd) == 0);
+
+ PedDevice *dev = ped_device_get (dev_name);
+ assert (dev);
+
+ PedDisk *disk = ped_disk_new_fresh (dev, ped_disk_type_get (argv[1]));
+ assert (disk);
+ assert (ped_disk_commit(disk));
+ ped_disk_destroy (disk);
+
+ /* re-open the disk */
+ disk = ped_disk_new (dev);
+ assert (disk);
+
+ /* Create a partition */
+ const PedFileSystemType *fs_type = ped_file_system_type_get ("ext2");
+ assert (fs_type);
+ PedPartitionType part_type = PED_PARTITION_NORMAL;
+ const PedGeometry *geometry = ped_geometry_new (dev, 2048, 1024);
+ assert (geometry);
+ PedPartition *part = ped_partition_new (disk, part_type, fs_type,
+ geometry->start, geometry->end);
+ assert (part);
+ PedConstraint *constraint = ped_constraint_exact (geometry);
+ assert (constraint);
+
+ if (ped_partition_is_flag_available (part, PED_PARTITION_BOOT))
+ assert (ped_partition_set_flag (part, PED_PARTITION_BOOT, 1));
+
+ assert (ped_disk_add_partition (disk, part, constraint));
+ ped_constraint_destroy (constraint);
+
+ assert (ped_partition_set_system (part, fs_type));
+ if (ped_partition_is_flag_available (part, PED_PARTITION_LBA))
+ ped_partition_set_flag (part, PED_PARTITION_LBA, 1);
+
+ /* Add a 2nd partition with a name (when supported) */
+ geometry = ped_geometry_new (dev, 4096, 1024);
+ assert (geometry);
+ part = ped_partition_new (disk, part_type, fs_type,
+ geometry->start, geometry->end);
+ assert (part);
+ constraint = ped_constraint_exact (geometry);
+ assert (constraint);
+ assert (ped_disk_add_partition (disk, part, constraint));
+ ped_constraint_destroy (constraint);
+ assert (ped_partition_set_system (part, fs_type));
+ if (ped_partition_is_flag_available (part, PED_PARTITION_LBA))
+ ped_partition_set_flag (part, PED_PARTITION_LBA, 1);
+ if (ped_disk_type_check_feature (part->disk->type, PED_DISK_TYPE_PARTITION_NAME))
+ ped_partition_set_name(part, "foobarbaz");
+
+ assert (ped_disk_commit(disk));
+
+ /* Duplicate it */
+ PedDisk *copy = ped_disk_duplicate (disk);
+ assert (ped_disk_commit(copy));
+
+ /* Compare the two copies */
+
+ /* Check the device */
+ assert (strcmp (disk->dev->model, copy->dev->model) == 0);
+ assert (strcmp (disk->dev->path, copy->dev->path) == 0);
+ assert (disk->dev->sector_size == copy->dev->sector_size);
+ assert (disk->dev->phys_sector_size == copy->dev->phys_sector_size);
+ assert (disk->dev->length == copy->dev->length);
+
+ /* Check the type */
+ assert (strcmp (disk->type->name, copy->type->name) == 0);
+ assert (disk->type->features == copy->type->features);
+
+ /* Check the flags */
+ for (PedDiskFlag flag = PED_DISK_FIRST_FLAG; flag <= PED_DISK_LAST_FLAG;
+ flag++) {
+ if (!ped_disk_is_flag_available(disk, flag))
+ continue;
+ assert (ped_disk_get_flag (disk, flag) == ped_disk_get_flag (copy, flag));
+ }
+
+ /* Check the partitions */
+ PedPartition *disk_part, *copy_part;
+ for ( disk_part = disk->part_list, copy_part = copy->part_list;
+ disk_part && copy_part;
+ disk_part = disk_part->next, copy_part = copy_part->next)
+ {
+ /* Only active partitions are duplicated */
+ if (!ped_partition_is_active (disk_part))
+ continue;
+
+ assert (disk_part->geom.start == copy_part->geom.start);
+ assert (disk_part->geom.end == copy_part->geom.end);
+ assert (disk_part->geom.length == copy_part->geom.length);
+ assert (disk_part->num == copy_part->num);
+ assert (disk_part->type == copy_part->type);
+
+ if (disk_part->fs_type && disk_part->fs_type->name) {
+ assert (strcmp (disk_part->fs_type->name, copy_part->fs_type->name) == 0);
+ }
+
+ /* Check the flags */
+ for (PedPartitionFlag flag = PED_PARTITION_FIRST_FLAG;
+ flag <= PED_PARTITION_LAST_FLAG; flag++)
+ {
+ if (!ped_partition_is_flag_available(disk_part, flag))
+ continue;
+ fprintf (stderr, "Checking partition flag %u\n", flag);
+ fprintf (stderr, "%d ? %d\n", ped_partition_get_flag (disk_part, flag),
+ ped_partition_get_flag (copy_part, flag));
+ assert (ped_partition_get_flag (disk_part, flag)
+ == ped_partition_get_flag (copy_part, flag));
+ }
+
+ /* Check the name, if supported */
+ if (ped_disk_type_check_feature (part->disk->type, PED_DISK_TYPE_PARTITION_NAME))
+ {
+ const char *disk_name = ped_partition_get_name(disk_part);
+ const char *copy_name = ped_partition_get_name(copy_part);
+ assert (strcmp (disk_name, copy_name) == 0);
+ }
+ }
+
+ /* Cleanup the mess */
+ ped_disk_destroy (copy);
+ ped_disk_destroy (disk);
+ ped_device_destroy (dev);
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/fs-resize.c b/tests/fs-resize.c
new file mode 100644
index 0000000..bc66178
--- /dev/null
+++ b/tests/fs-resize.c
@@ -0,0 +1,75 @@
+#include <config.h>
+
+#include <parted/parted.h>
+#include <parted/debug.h>
+
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <limits.h>
+
+#include "progname.h"
+
+int
+main (int argc, char **argv)
+{
+ set_program_name (argv[0]);
+
+ PedSector start = 0, len = 0;
+ PedGeometry geom, new_geom;
+ PedDevice *dev;
+ PedFileSystem *fs;
+ PedTimer *g_timer = NULL;
+
+ if (argc != 2 && argc != 4) {
+ fprintf(stderr, "usage: %s <device>\n"
+ " %s <device> <start> <length>\n",
+ argv[0], argv[0]);
+ return 1;
+ }
+
+ dev = ped_device_get(argv[1]);
+ if (!dev) {
+ fprintf(stderr, "cannot create device %s\n", argv[1]);
+ return 1;
+ }
+
+ if (!ped_device_open(dev)) {
+ fprintf(stderr, "cannot open device %s\n", argv[1]);
+ return 1;
+ }
+
+ if (!ped_geometry_init(&geom, dev, 0, dev->length)) {
+ fprintf(stderr, "cannot initialize geometry\n");
+ return 1;
+ }
+
+ if (argc > 2) {
+ start = strtoll(argv[2], NULL, 0);
+ len = strtoll(argv[3], NULL, 0);
+ } else {
+ start = 0;
+ len = dev->length;
+ }
+
+ if (!ped_geometry_init(&new_geom, dev, start, len)) {
+ fprintf(stderr, "cannot initialize new geometry\n");
+ return 1;
+ }
+
+ fs = ped_file_system_open(&geom);
+ if (!fs) {
+ fprintf(stderr, "cannot read fs\n");
+ return 1;
+ }
+
+ if (!ped_file_system_resize(fs, &new_geom, g_timer)) {
+ fprintf(stderr, "cannot resize filesystem\n");
+ return 1;
+ }
+
+ ped_file_system_close(fs);
+ return 0;
+}
diff --git a/tests/gpt-attrs b/tests/gpt-attrs
new file mode 100755
index 0000000..0a01447
--- /dev/null
+++ b/tests/gpt-attrs
@@ -0,0 +1,72 @@
+#!/usr/bin/python3
+
+# Copyright (C) 2021 SUSE LLC
+
+# program to show gpt partition attributes or set attributes of
+# partition 1
+
+# only works with 512 sectors and standard GPT header layout (128
+# partition entires with 128 bytes each, secondary header at end of
+# device)
+
+
+from struct import unpack_from, pack_into
+from zipfile import crc32
+import array
+import sys
+
+
+class Gpt:
+
+ # Calculate and insert the CRCs of the partition entires and the
+ # header.
+ def calc_crcs(self, header, entries):
+ # compute crc of partition entries
+ crc2 = crc32(entries) & 0xFFFFFFFF
+ pack_into('<L', header, 88, crc2)
+
+ # compute crc of header
+ pack_into('<L', header, 16, 0)
+ crc1 = crc32(header[:92]) & 0xFFFFFFFF
+ pack_into('<L', header, 16, crc1)
+
+ def read(self, name):
+ self.name = name
+
+ file = open(name, 'rb+')
+
+ file.seek(512)
+ self.primary_header = array.array('B', file.read(512))
+ self.primary_entries = array.array('B', file.read(32 * 512))
+
+ file.seek(-33 * 512, 2)
+ self.secondary_entries = array.array('B', file.read(32 * 512))
+ self.secondary_header = array.array('B', file.read(512))
+
+ def write(self):
+ file = open(self.name, 'rb+')
+
+ self.calc_crcs(self.primary_header, self.primary_entries)
+ file.seek(512)
+ file.write(self.primary_header)
+ file.write(self.primary_entries)
+
+ self.calc_crcs(self.secondary_header, self.secondary_entries)
+ file.seek(-33 * 512, 2)
+ file.write(self.secondary_entries)
+ file.write(self.secondary_header)
+
+
+gpt = Gpt()
+
+gpt.read(sys.argv[1])
+
+if sys.argv[2] == "show":
+ attrs = unpack_from('<Q', gpt.primary_entries, 48)[0]
+ print(hex(attrs))
+
+if sys.argv[2] == "set":
+ attrs = int(sys.argv[3], 0)
+ pack_into('<Q', gpt.primary_entries, 48, attrs)
+ pack_into('<Q', gpt.secondary_entries, 48, attrs)
+ gpt.write()
diff --git a/tests/gpt-header-move b/tests/gpt-header-move
new file mode 100755
index 0000000..18f58d0
--- /dev/null
+++ b/tests/gpt-header-move
@@ -0,0 +1,42 @@
+#!/usr/bin/python3
+
+# open img file, subtract 33 from altlba address, and move the last 33 sectors
+# back by 33 sectors
+
+from struct import unpack_from, pack_into
+from zipfile import crc32
+import array
+import sys
+
+file = open(sys.argv[1],'rb+')
+file.seek(512)
+gptheader = file.read(512)
+altlba = unpack_from('<q', gptheader, offset=32)[0]
+gptheader = array.array('B', gptheader)
+pack_into('<Q', gptheader, 32, altlba-33)
+#zero header crc
+pack_into('<L', gptheader, 16, 0)
+#compute new crc
+newcrc = ((crc32(gptheader[:92])) & 0xFFFFFFFF)
+pack_into('<L', gptheader, 16, newcrc)
+file.seek(512)
+file.write(gptheader)
+file.seek(512*altlba)
+gptheader = file.read(512)
+file.seek(512*(altlba-32))
+backup = file.read(512*32)
+altlba -= 33
+gptheader = array.array('B',gptheader)
+#update mylba
+pack_into('<Q', gptheader, 24, altlba)
+#update table lba
+pack_into('<Q', gptheader, 72, altlba-32)
+#zero header crc
+pack_into('<L', gptheader, 16, 0)
+#compute new crc
+newcrc = ((crc32(gptheader[:92])) & 0xFFFFFFFF)
+pack_into('<L', gptheader, 16, newcrc)
+file.seek(512*(altlba-32))
+file.write(backup)
+file.write(gptheader)
+file.write(b"\0" * (512 * 33))
diff --git a/tests/gpt-header-munge b/tests/gpt-header-munge
new file mode 100755
index 0000000..5c0dd80
--- /dev/null
+++ b/tests/gpt-header-munge
@@ -0,0 +1,285 @@
+#!/usr/bin/perl -w
+# Change the size of a GPT image's partition array.
+
+# The vast majority of GPT partition tables have an 128-entry partition array.
+# However, we get reports of ZFS-related arrays with a mere 9 entries, and
+# some others with 140, and parted could not handle either of those because
+# it was effectively hard-coding the 128.
+# This script takes as input a GPT image that might be created by
+# parted itself, and transforms it into one with a different number, N,
+# of partition array entries. That involves the following steps:
+# - poke that value of N into the 4-byte "Number of partition entries" slot,
+# - compute the crc32 of the N partition table entries,
+# - poke the resulting value into its slot,
+# - recompute the GPT header's CRC32 checksum and poke that into its slot.
+# Do the above for both the primary and the backup GPT headers.
+
+use strict;
+use warnings;
+use Digest::CRC qw(crc32);
+use List::Util qw(max);
+
+(my $ME = $0) =~ s|.*/||;
+my $VERSION = '1.0';
+
+# Technically we shouldn't hard-code this, since it's specified
+# as the little-endian number in bytes 12..15 of the GPT header.
+my $gpt_header_len = 92;
+
+# Size of a partition array entry, in bytes.
+# This too is specified in the GPT header, but AFAIK, no one changes it.
+my $pe_size = 128;
+
+# Sector size.
+my $ss;
+
+# Sector number of the backup GPT header, to be read from the primary header.
+my $backup_LBA;
+
+# Given a GPT header $B, extract the my_LBA/backup_LBA sector number.
+sub curr_LBA($) { my ($b) = @_; unpack ('Q<', substr ($b, 24, 8)) }
+sub backup_LBA($) { my ($b) = @_; unpack ('Q<', substr ($b, 32, 8)) }
+
+# Given a GPT header $B, return its "partition entries starting LBA".
+sub pe_start_LBA($) { my ($b) = @_; unpack ('Q<', substr ($b, 72, 8)) }
+
+sub round_up_to_ss ($)
+{
+ my ($n) = @_;
+ return $n + $ss - $n % $ss;
+}
+
+# Return the byte offset of the start of the specified partition array.
+sub partition_array_start_offset ($$)
+{
+ my ($pri_or_backup, $n_pe) = @_;
+ $pri_or_backup eq 'primary'
+ and return 2 * $ss;
+
+ # Backup
+ return $backup_LBA * $ss - round_up_to_ss ($n_pe * $pe_size);
+}
+
+# Calculate and return the specified partition array crc32 checksum.
+sub partition_array_crc ($$$)
+{
+ my ($pri_or_backup, $n_pe, $in) = @_;
+ local *F;
+ open F, '<', $in
+ or die "$ME: failed to open $in: $!\n";
+
+ # Seek to start of partition array.
+ my $off = partition_array_start_offset $pri_or_backup, $n_pe;
+ sysseek (F, $off, 0)
+ or die "$ME: $in: failed to seek to $off: $!\n";
+
+ # Read the array.
+ my $p;
+ my $pe_buf;
+ my $n = $n_pe * $pe_size;
+ ($p = sysread F, $pe_buf, $n) && $p == $n
+ or die "$ME: $in: failed to read $pri_or_backup partition array:($p:$n) $!\n";
+
+ return crc32 $pe_buf;
+}
+
+# Verify the initial CRC of BUF.
+sub check_GPT_header ($$$)
+{
+ my ($pri_or_backup, $in, $buf) = @_;
+
+ my $curr = curr_LBA $buf;
+ my $backup = backup_LBA $buf;
+ ($pri_or_backup eq 'primary') == ($curr == 1)
+ or die "$ME: $in: invalid curr_LBA($curr) in $pri_or_backup header\n";
+ ($pri_or_backup eq 'primary') == (34 < $backup)
+ or die "$ME: $in: invalid backup_LBA($backup) in $pri_or_backup header\n";
+
+ $pri_or_backup eq 'backup' && $backup != 1
+ and die "$ME: $in: the backup_LBA in the backup header must be 1\n";
+
+ # A primary partition's "partition entries starting LBA" must be 2.
+ if ($pri_or_backup eq 'primary')
+ {
+ my $p = pe_start_LBA $buf;
+ $p == 2
+ or die "$ME: $in: primary header's PE start LBA is $p (should be 2)\n";
+ }
+
+ # Save a copy of the CRC, then zero that field, bytes 16..19:
+ my $orig_crc = unpack ('L<', substr ($buf, 16, 4));
+ substr ($buf, 16, 4) = "\0" x 4;
+
+ # Compute CRC32 of header: it'd better match.
+ my $crc = crc32($buf);
+ $orig_crc == $crc
+ or die "$ME: $in: cannot reproduce $pri_or_backup GPT header's CRC32\n";
+}
+
+# Poke the $N_PE value into $$BUF's number-of-partition-entries slot.
+sub poke_n_pe ($$)
+{
+ my ($buf, $n_pe) = @_;
+
+ # Poke the little-endian value into place.
+ substr ($$buf, 80, 4) = pack ('L<', $n_pe);
+}
+
+# Compute/set partition-array CRC (given $N_PE), then compute a new
+# header-CRC and poke it into its position, too.
+sub set_CRCs ($$$$)
+{
+ my ($pri_or_backup, $buf, $in, $n_pe) = @_;
+
+ # Compute CRC of primary partition array and put it in substr ($pri, 88, 4)
+ my $pa_crc = partition_array_crc $pri_or_backup, $n_pe, $in;
+ substr ($$buf, 88, 4) = pack ('L<', $pa_crc);
+
+ # In the backup header, we must also set the 8-byte "Partition entries
+ # starting LBA number" field to reflect our new value of $n_pe.
+ if ($pri_or_backup eq 'backup')
+ {
+ my $off = partition_array_start_offset $pri_or_backup, $n_pe;
+ $off % $ss == 0
+ or die "$ME: internal error: starting LBA byte offset($off) is"
+ . " not a multiple of $ss\n";
+ my $lba = $off / $ss;
+ substr ($$buf, 72, 8) = pack ('Q<', $lba);
+ }
+
+ # Before we compute the checksum, we must zero-out the 4-byte
+ # slot into which we'll store the result.
+ substr ($$buf, 16, 4) = "\0" x 4;
+ my $crc = crc32($$buf);
+ substr ($$buf, 16, 4) = pack ('L<', $crc);
+}
+
+sub usage ($)
+{
+ my ($exit_code) = @_;
+ my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
+ if ($exit_code != 0)
+ {
+ print $STREAM "Try `$ME --help' for more information.\n";
+ }
+ else
+ {
+ print $STREAM <<EOF;
+Usage: $ME [OPTIONS] FILE
+Change the number of GPT partition array entries in FILE.
+
+This option must be specified:
+
+ --n-partition-array-entries=N FIXME
+
+The following are optional:
+
+ --sector-size=N assume sector size of N bytes (default: 512)
+ --help display this help and exit
+ --version output version information and exit
+
+EXAMPLE:
+
+ dd if=/dev/null of=F bs=1 seek=6MB
+ parted -s F mklabel gpt
+ $ME --n=9 F
+
+EOF
+ }
+ exit $exit_code;
+}
+
+{
+ my $n_partition_entries;
+
+ use Getopt::Long;
+ GetOptions
+ (
+ 'n-partition-array-entries=i' => \$n_partition_entries,
+ 'sector-size=i' => \$ss,
+
+ help => sub { usage 0 },
+ version => sub { print "$ME version $VERSION\n"; exit },
+ ) or usage 1;
+
+ defined $n_partition_entries
+ or (warn "$ME: --n-partition-array-entries=N not specified\n"), usage 1;
+
+ defined $ss
+ or $ss = 512;
+
+ # Require sensible number:
+ # It must either be <= 128, or else a multiple of 4 so that at 128 bytes each,
+ # this array fully occupies a whole number of 512-byte sectors.
+ 1 <= $n_partition_entries
+ && ($n_partition_entries <= 128
+ || $n_partition_entries % 4 == 0)
+ or die "$ME: invalid number of partition entries: $n_partition_entries\n";
+
+ @ARGV == 1
+ or (warn "$ME: no file specified\n"), usage 1;
+
+ my $in = $ARGV[0];
+ local *F;
+ open F, '<', $in
+ or die "$ME: failed to open $in: $!\n";
+
+ # Get length and perform some basic sanity checks.
+ my $len = sysseek (F, 0, 2);
+ defined $len
+ or die "$ME: $in: failed to seek to EOF: $!\n";
+ my $min_n_sectors = 34 + 33 + ($n_partition_entries * $pe_size + $ss - 1) / $ss;
+ my $n_sectors = int (($len + $ss - 1) / $ss);
+ $n_sectors < $min_n_sectors
+ and die "$ME: $in: image file is too small to contain a GPT image\n";
+ $len % $ss == 0
+ or die "$ME: $in: size is not a multiple of $ss: $!\n";
+
+ # Skip 1st sector.
+ sysseek (F, $ss, 0)
+ or die "$ME: $in: failed to seek to byte $ss: $!\n";
+
+ # Read the primary GPT header.
+ my $p;
+ my $pri;
+ ($p = sysread F, $pri, $gpt_header_len) && $p == $gpt_header_len
+ or die "$ME: $in: failed to read the primary GPT header: $!\n";
+
+ $backup_LBA = unpack ('Q<', substr ($pri, 32, 8));
+
+ # Seek-to and read the backup GPT header.
+ sysseek (F, $backup_LBA * $ss, 0)
+ or die "$ME: $in: failed to seek to backup LBA $backup_LBA: $!\n";
+ my $backup;
+ ($p = sysread F, $backup, $gpt_header_len) && $p == $gpt_header_len
+ or die "$ME: $in: read failed: $!\n";
+
+ close F;
+
+ check_GPT_header ('primary', $in, $pri);
+ check_GPT_header ('backup', $in, $backup);
+
+ poke_n_pe (\$pri, $n_partition_entries);
+ poke_n_pe (\$backup, $n_partition_entries);
+
+ # set both PE CRC and header CRCs:
+ set_CRCs 'primary', \$pri, $in, $n_partition_entries;
+ set_CRCs 'backup', \$backup, $in, $n_partition_entries;
+
+ # Write both headers back to the file:
+ open F, '+<', $in
+ or die "$ME: failed to open $in: $!\n";
+
+ sysseek (F, $ss, 0)
+ or die "$ME: $in: failed to seek to byte $ss: $!\n";
+ syswrite F, $pri
+ or die "$ME: $in: failed to write primary header: $!\n";
+
+ sysseek (F, $backup_LBA * $ss, 0)
+ or die "$ME: $in: failed to seek to backup LBA $backup_LBA: $!\n";
+ syswrite F, $backup
+ or die "$ME: $in: failed to write backup header: $!\n";
+
+ close F
+ or die "$ME: failed to close $in: $!\n";
+ }
diff --git a/tests/help-version.sh b/tests/help-version.sh
new file mode 100755
index 0000000..e88cd13
--- /dev/null
+++ b/tests/help-version.sh
@@ -0,0 +1,282 @@
+#! /bin/sh
+# Make sure all these programs work properly
+# when invoked with --help or --version.
+
+# Copyright (C) 2000-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+# Ensure that $SHELL is set to *some* value and exported.
+# This is required for dircolors, which would fail e.g., when
+# invoked via debuild (which removes SHELL from the environment).
+test "x$SHELL" = x && SHELL=/bin/sh
+export SHELL
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+expected_failure_status_chroot=125
+expected_failure_status_env=125
+expected_failure_status_nice=125
+expected_failure_status_nohup=125
+expected_failure_status_stdbuf=125
+expected_failure_status_su=125
+expected_failure_status_timeout=125
+expected_failure_status_printenv=2
+expected_failure_status_tty=3
+expected_failure_status_sort=2
+expected_failure_status_expr=3
+expected_failure_status_lbracket=2
+expected_failure_status_dir=2
+expected_failure_status_ls=2
+expected_failure_status_vdir=2
+
+expected_failure_status_cmp=2
+expected_failure_status_zcmp=2
+expected_failure_status_sdiff=2
+expected_failure_status_diff3=2
+expected_failure_status_diff=2
+expected_failure_status_zdiff=2
+expected_failure_status_zgrep=2
+expected_failure_status_zegrep=2
+expected_failure_status_zfgrep=2
+
+expected_failure_status_grep=2
+expected_failure_status_egrep=2
+expected_failure_status_fgrep=2
+
+test "$built_programs" \
+ || fail_ "built_programs not specified!?!"
+
+test "$VERSION" \
+ || fail_ "set envvar VERSION; it is required for a PATH sanity-check"
+
+# Extract version from --version output of the first program
+for i in $built_programs; do
+ v=$(env $i --version | sed -n '1s/.* //p;q')
+ break
+done
+
+# Ensure that it matches $VERSION.
+test "x$v" = "x$VERSION" \
+ || fail_ "--version-\$VERSION mismatch"
+
+for lang in C fr da; do
+ for i in $built_programs; do
+
+ # Skip `test'; it doesn't accept --help or --version.
+ test $i = test && continue;
+
+ # false fails even when invoked with --help or --version.
+ if test $i = false; then
+ env LC_MESSAGES=$lang $i --help >/dev/null && fail=1
+ env LC_MESSAGES=$lang $i --version >/dev/null && fail=1
+ continue
+ fi
+
+ # The just-built install executable is always named `ginstall'.
+ test $i = install && i=ginstall
+
+ # Make sure they exit successfully, under normal conditions.
+ env $i --help > h-$i || fail=1
+ env $i --version >/dev/null || fail=1
+
+ # Make sure they mention the bug-reporting address in --help output.
+ grep "$PACKAGE_BUGREPORT" h-$i > /dev/null || fail=1
+ rm -f h-$i
+
+ # Make sure they fail upon `disk full' error.
+ if test -w /dev/full && test -c /dev/full; then
+ env $i --help >/dev/full 2>/dev/null && fail=1
+ env $i --version >/dev/full 2>/dev/null && fail=1
+ status=$?
+ test $i = [ && prog=lbracket || prog=$i
+ eval "expected=\$expected_failure_status_$prog"
+ test x$expected = x && expected=1
+ if test $status = $expected; then
+ : # ok
+ else
+ fail=1
+ echo "*** $i: bad exit status \`$status' (expected $expected)," 1>&2
+ echo " with --help or --version output redirected to /dev/full" 1>&2
+ fi
+ fi
+ done
+done
+
+bigZ_in=bigZ-in.Z
+zin=zin.gz
+zin2=zin2.gz
+
+tmp=tmp-$$
+tmp_in=in-$$
+tmp_in2=in2-$$
+tmp_dir=dir-$$
+tmp_out=out-$$
+mkdir $tmp || fail=1
+cd $tmp || fail=1
+
+comm_setup () { args="$tmp_in $tmp_in"; }
+csplit_setup () { args="$tmp_in //"; }
+cut_setup () { args='-f 1'; }
+join_setup () { args="$tmp_in $tmp_in"; }
+tr_setup () { args='a a'; }
+
+chmod_setup () { args="a+x $tmp_in"; }
+# Punt on these.
+chgrp_setup () { args=--version; }
+chown_setup () { args=--version; }
+mkfifo_setup () { args=--version; }
+mknod_setup () { args=--version; }
+# Punt on uptime, since it fails (e.g., failing to get boot time)
+# on some systems, and we shouldn't let that stop `make check'.
+uptime_setup () { args=--version; }
+
+# Create a file in the current directory, not in $TMPDIR.
+mktemp_setup () { args=mktemp.XXXX; }
+
+cmp_setup () { args="$tmp_in $tmp_in2"; }
+
+# Tell dd not to print the line with transfer rate and total.
+# The transfer rate would vary between runs.
+dd_setup () { args=status=noxfer; }
+
+zdiff_setup () { args="$zin $zin2"; }
+zcmp_setup () { args="$zin $zin2"; }
+zcat_setup () { args=$zin; }
+gunzip_setup () { args=$zin; }
+zmore_setup () { args=$zin; }
+zless_setup () { args=$zin; }
+znew_setup () { args=$bigZ_in; }
+zforce_setup () { args=$zin; }
+zgrep_setup () { args="z $zin"; }
+zegrep_setup () { args="z $zin"; }
+zfgrep_setup () { args="z $zin"; }
+gzexe_setup () { args=$tmp_in; }
+
+# We know that $tmp_in contains a "0"
+grep_setup () { args="0 $tmp_in"; }
+egrep_setup () { args="0 $tmp_in"; }
+fgrep_setup () { args="0 $tmp_in"; }
+
+diff_setup () { args="$tmp_in $tmp_in2"; }
+sdiff_setup () { args="$tmp_in $tmp_in2"; }
+diff3_setup () { args="$tmp_in $tmp_in2 $tmp_in2"; }
+cp_setup () { args="$tmp_in $tmp_in2"; }
+ln_setup () { args="$tmp_in ln-target"; }
+ginstall_setup () { args="$tmp_in $tmp_in2"; }
+mv_setup () { args="$tmp_in $tmp_in2"; }
+mkdir_setup () { args=$tmp_dir/subdir; }
+rmdir_setup () { args=$tmp_dir; }
+rm_setup () { args=$tmp_in; }
+shred_setup () { args=$tmp_in; }
+touch_setup () { args=$tmp_in2; }
+truncate_setup () { args="--reference=$tmp_in $tmp_in2"; }
+
+mkid_setup () { printf 'f(){}\ntypedef int t;\n' > f.c; args=. ; }
+lid_setup () { args=; }
+fid_setup () { args=f.c; }
+fnid_setup () { args=; }
+xtokid_setup () { args=; }
+aid_setup () { args=f; }
+eid_setup () { args=--version; }
+gid_setup () { args=f; }
+defid_setup () { args=t; }
+
+basename_setup () { args=$tmp_in; }
+dirname_setup () { args=$tmp_in; }
+expr_setup () { args=foo; }
+
+# Punt, in case GNU `id' hasn't been installed yet.
+groups_setup () { args=--version; }
+
+pathchk_setup () { args=$tmp_in; }
+yes_setup () { args=--version; }
+logname_setup () { args=--version; }
+nohup_setup () { args=--version; }
+printf_setup () { args=foo; }
+seq_setup () { args=10; }
+sleep_setup () { args=0; }
+su_setup () { args=--version; }
+stdbuf_setup () { args="-oL true"; }
+timeout_setup () { args=--version; }
+
+# I'd rather not run sync, since it spins up disks that I've
+# deliberately caused to spin down (but not unmounted).
+sync_setup () { args=--version; }
+
+test_setup () { args=foo; }
+
+# This is necessary in the unusual event that there is
+# no valid entry in /etc/mtab.
+df_setup () { args=/; }
+
+# This is necessary in the unusual event that getpwuid (getuid ()) fails.
+id_setup () { args=-u; }
+
+# Use env to avoid invoking built-in sleep of Solaris 11's /bin/sh.
+kill_setup () {
+ env sleep 10m &
+ args=$!
+}
+
+link_setup () { args="$tmp_in link-target"; }
+unlink_setup () { args=$tmp_in; }
+
+readlink_setup () {
+ ln -s . slink
+ args=slink;
+}
+
+stat_setup () { args=$tmp_in; }
+unlink_setup () { args=$tmp_in; }
+lbracket_setup () { args=": ]"; }
+
+parted_setup () { args="-s $tmp_in mklabel gpt"
+ dd if=/dev/null of=$tmp_in seek=2000; }
+
+# Ensure that each program "works" (exits successfully) when doing
+# something more than --help or --version.
+for i in $built_programs; do
+ # Skip these.
+ case $i in chroot|stty|tty|false|chcon|runcon) continue;; esac
+
+ rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out $bigZ_in $zin $zin2
+ echo z |gzip > $zin
+ cp $zin $zin2
+ cp $zin $bigZ_in
+
+ # This is sort of kludgey: use numbers so this is valid input for factor,
+ # and two tokens so it's valid input for tsort.
+ echo 2147483647 0 > $tmp_in
+ # Make $tmp_in2 identical. Then, using $tmp_in and $tmp_in2 as arguments
+ # to the likes of cmp and diff makes them exit successfully.
+ cp $tmp_in $tmp_in2
+ mkdir $tmp_dir
+ # echo ================== $i
+ test $i = [ && prog=lbracket || prog=$i
+ if type ${prog}_setup > /dev/null 2>&1; then
+ ${prog}_setup
+ else
+ args=
+ fi
+ if env $i $args < $tmp_in > $tmp_out; then
+ : # ok
+ else
+ echo FAIL: $i
+ fail=1
+ fi
+ rm -rf $tmp_in $tmp_in2 $tmp_out $tmp_dir
+done
+
+Exit $fail
diff --git a/tests/init.cfg b/tests/init.cfg
new file mode 100644
index 0000000..dc8b2bc
--- /dev/null
+++ b/tests/init.cfg
@@ -0,0 +1,132 @@
+# This file is sourced by init.sh, *before* its initialization.
+
+# This goes hand in hand with the "exec 9>&2;" in tests/Makefile.am's
+# TESTS_ENVIRONMENT definition.
+stderr_fileno_=9
+
+# For repeatability, reset the environment to known value.
+LANG=C
+LC_ALL=C
+TZ=UTC
+export LANG LC_ALL TZ
+export PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING=1
+
+# Protect ourselves from common misconfiguration to export
+# CDPATH into the environment
+unset CDPATH
+
+# Suppress readline initialization garbage.
+unset TERM
+
+sector_size_=${PARTED_SECTOR_SIZE:-512}
+
+require_512_byte_sector_size_()
+{
+ test $sector_size_ = 512 || skip_ 'FS test with sector size != 512'
+}
+
+# Having an unsearchable directory in PATH causes execve to fail with EACCES
+# when applied to an unresolvable program name, contrary to the desired ENOENT.
+# Avoid the problem by rewriting PATH to exclude unsearchable directories.
+# Also, if PATH lacks /sbin and/or /usr/sbin, append it/them.
+sanitize_path_()
+{
+ # FIXME: remove double quotes around $IFS when all tests use init.sh.
+ # They constitute a work-around for a bug in FreeBSD 8.1's /bin/sh.
+ local saved_IFS="$IFS"
+ IFS=:
+ set -- $PATH
+ IFS=$saved_IFS
+
+ local d d1
+ local colon=
+ local new_path=
+ for d in "$@"; do
+ test -z "$d" && d1=. || d1=$d
+ if ls -d "$d1/." > /dev/null 2>&1; then
+ new_path="$new_path$colon$d"
+ colon=':'
+ fi
+ done
+
+ for d in /sbin /usr/sbin ; do
+ case ":$new_path:" in
+ *:$d:*) ;;
+ *) new_path="$new_path:$d" ;;
+ esac
+ done
+
+ PATH=$new_path
+ export PATH
+}
+
+require_udevadm_settle_()
+{
+ udevadm --help > /dev/null \
+ || skip_ 'udevadm command is required for this test'
+}
+
+require_perl_digest_crc_()
+{
+ local ok=0
+ local t
+ t=$(perl -le 'use Digest::CRC qw(crc32); print crc32("123")') \
+ && test $t = 2286445522 && ok=1
+ test $ok = 1 \
+ || skip_ "this test requires Perl's Digest::CRC module"
+}
+
+# We need two cleanup functions. One, cleanup_final_, is sometimes
+# used (transparently) via t-local.sh's modprobe/rmmod code.
+# The other is used e.g., to unmount.
+cleanup_final_() { :; }
+cleanup_fn_() { :; }
+cleanup_() { cleanup_fn_; cleanup_final_; }
+
+# Use this for a test that requires an actual hardware device, e.g., a real
+# disk, a USB key, or a CD-RW. The envvars $DEVICE_TO_ERASE and
+# $DEVICE_TO_ERASE_SIZE must be set properly. Otherwise, skip the test.
+require_erasable_()
+{
+ # Skip quietly if both envvars are not specified.
+ test -n "$DEVICE_TO_ERASE" && test -n "$DEVICE_TO_ERASE_SIZE" \
+ || skip_ 'This test requires an erasable device and you have not properly' \
+ 'set the $DEVICE_TO_ERASE and $DEVICE_TO_ERASE_SIZE envvars.'
+
+ # Since testing a drive with parted destroys all data on that drive,
+ # we have rather draconian safety requirements that should help avoid
+ # accidents. If $dev_ is the name of the device,
+ # - running "parted -s $dev_ print" must succeed, and
+ # - its output must include a line matching /^Disk $dev_: $DEV_SIZE$/
+ # - Neither $dev_ nor any $dev_[0-9]* may be mounted.
+ dev_=$DEVICE_TO_ERASE
+ sz=$DEVICE_TO_ERASE_SIZE
+ parted_output=$(parted -s $dev_ print) || fail_ "no such device: $dev_"
+ parted -s $dev_ print|grep "^Disk $dev_: $sz$" \
+ > /dev/null || fail_ "actual device size is not $sz"
+ # Try to see if $dev_ or any of its partitions is mounted.
+ # This is not reliable. FIXME: find a better way.
+ # Maybe expose parted's own test for whether a disk is in use.
+ # The following assume that $dev_ is canonicalized, e.g., that $dev_
+ # contains no "//" or "/./" components.
+
+ # Prefer df --local, if it works, so we don't waste time
+ # enumerating lots of automounted file systems.
+ ( df --local / > /dev/null 2>&1 ) && df='df --local' || df=df
+ $df | grep "^$dev_" && fail_ "$dev_ is already mounted"
+ $df | grep "^$dev_[0-9]" && fail_ "a partition of $dev_ is already mounted"
+}
+
+# At least Fedora 16 (kernel 3.1.6-1.fc16.x86_64) fails this test.
+require_partitionable_loop_device_()
+{
+ local f=/sys/devices/virtual/block/$(basename $1)/ext_range
+ case $(cat "$f") in
+ ''|0|1) skip_ your system is not configured to partition loop devices;;
+ esac
+}
+
+sanitize_path_
+
+. "$abs_top_srcdir/tests/t-lib-helpers.sh"
+. "$abs_top_srcdir/tests/t-local.sh"
diff --git a/tests/init.sh b/tests/init.sh
new file mode 100644
index 0000000..e857272
--- /dev/null
+++ b/tests/init.sh
@@ -0,0 +1,589 @@
+# source this file; set up for tests
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+# Using this file in a test
+# =========================
+#
+# The typical skeleton of a test looks like this:
+#
+# #!/bin/sh
+# . "${srcdir=.}/init.sh"; path_prepend_ .
+# Execute some commands.
+# Note that these commands are executed in a subdirectory, therefore you
+# need to prepend "../" to relative filenames in the build directory.
+# Note that the "path_prepend_ ." is useful only if the body of your
+# test invokes programs residing in the initial directory.
+# For example, if the programs you want to test are in src/, and this test
+# script is named tests/test-1, then you would use "path_prepend_ ../src",
+# or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH"
+# to all tests via automake's TESTS_ENVIRONMENT.
+# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure.
+# Use the skip_ and fail_ functions to print a diagnostic and then exit
+# with the corresponding exit code.
+# Exit $?
+
+# Executing a test that uses this file
+# ====================================
+#
+# Running a single test:
+# $ make check TESTS=test-foo.sh
+#
+# Running a single test, with verbose output:
+# $ make check TESTS=test-foo.sh VERBOSE=yes
+#
+# Running a single test, with single-stepping:
+# 1. Go into a sub-shell:
+# $ bash
+# 2. Set relevant environment variables from TESTS_ENVIRONMENT in the
+# Makefile:
+# $ export srcdir=../../tests # this is an example
+# 3. Execute the commands from the test, copy&pasting them one by one:
+# $ . "$srcdir/init.sh"; path_prepend_ .
+# ...
+# 4. Finally
+# $ exit
+
+ME_=`expr "./$0" : '.*/\(.*\)$'`
+
+# We use a trap below for cleanup. This requires us to go through
+# hoops to get the right exit status transported through the handler.
+# So use 'Exit STATUS' instead of 'exit STATUS' inside of the tests.
+# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
+# sh inside this function.
+Exit () { set +e; (exit $1); exit $1; }
+
+# Print warnings (e.g., about skipped and failed tests) to this file number.
+# Override by defining to say, 9, in init.cfg, and putting say,
+# export ...ENVVAR_SETTINGS...; $(SHELL) 9>&2
+# in the definition of TESTS_ENVIRONMENT in your tests/Makefile.am file.
+# This is useful when using automake's parallel tests mode, to print
+# the reason for skip/failure to console, rather than to the .log files.
+: ${stderr_fileno_=2}
+
+# Note that correct expansion of "$*" depends on IFS starting with ' '.
+# Always write the full diagnostic to stderr.
+# When stderr_fileno_ is not 2, also emit the first line of the
+# diagnostic to that file descriptor.
+warn_ ()
+{
+ # If IFS does not start with ' ', set it and emit the warning in a subshell.
+ case $IFS in
+ ' '*) printf '%s\n' "$*" >&2
+ test $stderr_fileno_ = 2 \
+ || { printf '%s\n' "$*" | sed 1q >&$stderr_fileno_ ; } ;;
+ *) (IFS=' '; warn_ "$@");;
+ esac
+}
+fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; }
+skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; }
+fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; }
+framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; }
+
+# Sanitize this shell to POSIX mode, if possible.
+DUALCASE=1; export DUALCASE
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+ esac
+fi
+
+# We require $(...) support unconditionally.
+# We require a few additional shell features only when $EXEEXT is nonempty,
+# in order to support automatic $EXEEXT emulation:
+# - hyphen-containing alias names
+# - we prefer to use ${var#...} substitution, rather than having
+# to work around lack of support for that feature.
+# The following code attempts to find a shell with support for these features.
+# If the current shell passes the test, we're done. Otherwise, test other
+# shells until we find one that passes. If one is found, re-exec it.
+# If no acceptable shell is found, skip the current test.
+#
+# The "...set -x; P=1 true 2>err..." test is to disqualify any shell that
+# emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do.
+#
+# Use "9" to indicate success (rather than 0), in case some shell acts
+# like Solaris 10's /bin/sh but exits successfully instead of with status 2.
+
+# Eval this code in a subshell to determine a shell's suitability.
+# 10 - passes all tests; ok to use
+# 9 - ok, but enabling "set -x" corrupts app stderr; prefer higher score
+# ? - not ok
+gl_shell_test_script_='
+test $(echo y) = y || exit 1
+score_=10
+if test "$VERBOSE" = yes; then
+ test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9
+fi
+test -z "$EXEEXT" && exit $score_
+shopt -s expand_aliases
+alias a-b="echo zoo"
+v=abx
+ test ${v%x} = ab \
+ && test ${v#a} = bx \
+ && test $(a-b) = zoo \
+ && exit $score_
+'
+
+if test "x$1" = "x--no-reexec"; then
+ shift
+else
+ # Assume a working shell. Export to subshells (setup_ needs this).
+ gl_set_x_corrupts_stderr_=false
+ export gl_set_x_corrupts_stderr_
+
+ # Record the first marginally acceptable shell.
+ marginal_=
+
+ # Search for a shell that meets our requirements.
+ for re_shell_ in __current__ "${CONFIG_SHELL:-no_shell}" \
+ /bin/sh bash dash zsh pdksh fail
+ do
+ test "$re_shell_" = no_shell && continue
+
+ # If we've made it all the way to the sentinel, "fail" without
+ # finding even a marginal shell, skip this test.
+ if test "$re_shell_" = fail; then
+ test -z "$marginal_" && skip_ failed to find an adequate shell
+ re_shell_=$marginal_
+ break
+ fi
+
+ # When testing the current shell, simply "eval" the test code.
+ # Otherwise, run it via $re_shell_ -c ...
+ if test "$re_shell_" = __current__; then
+ # 'eval'ing this code makes Solaris 10's /bin/sh exit with
+ # $? set to 2. It does not evaluate any of the code after the
+ # "unexpected" first '('. Thus, we must run it in a subshell.
+ ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
+ else
+ "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
+ fi
+
+ st_=$?
+
+ # $re_shell_ works just fine. Use it.
+ if test $st_ = 10; then
+ gl_set_x_corrupts_stderr_=false
+ break
+ fi
+
+ # If this is our first marginally acceptable shell, remember it.
+ if test "$st_:$marginal_" = 9: ; then
+ marginal_="$re_shell_"
+ gl_set_x_corrupts_stderr_=true
+ fi
+ done
+
+ if test "$re_shell_" != __current__; then
+ # Found a usable shell. Preserve -v and -x.
+ case $- in
+ *v*x* | *x*v*) opts_=-vx ;;
+ *v*) opts_=-v ;;
+ *x*) opts_=-x ;;
+ *) opts_= ;;
+ esac
+ exec "$re_shell_" $opts_ "$0" --no-reexec "$@"
+ echo "$ME_: exec failed" 1>&2
+ exit 127
+ fi
+fi
+
+# If this is bash, turn off all aliases.
+test -n "$BASH_VERSION" && unalias -a
+
+# Note that when supporting $EXEEXT (transparently mapping from PROG_NAME to
+# PROG_NAME.exe), we want to support hyphen-containing names like test-acos.
+# That is part of the shell-selection test above. Why use aliases rather
+# than functions? Because support for hyphen-containing aliases is more
+# widespread than that for hyphen-containing function names.
+test -n "$EXEEXT" && shopt -s expand_aliases
+
+# Enable glibc's malloc-perturbing option.
+# This is useful for exposing code that depends on the fact that
+# malloc-related functions often return memory that is mostly zeroed.
+# If you have the time and cycles, use valgrind to do an even better job.
+: ${MALLOC_PERTURB_=87}
+export MALLOC_PERTURB_
+
+# This is a stub function that is run upon trap (upon regular exit and
+# interrupt). Override it with a per-test function, e.g., to unmount
+# a partition, or to undo any other global state changes.
+cleanup_ () { :; }
+
+# Emit a header similar to that from diff -u; Print the simulated "diff"
+# command so that the order of arguments is clear. Don't bother with @@ lines.
+emit_diff_u_header_ ()
+{
+ printf '%s\n' "diff -u $*" \
+ "--- $1 1970-01-01" \
+ "+++ $2 1970-01-01"
+}
+
+# Arrange not to let diff or cmp operate on /dev/null,
+# since on some systems (at least OSF/1 5.1), that doesn't work.
+# When there are not two arguments, or no argument is /dev/null, return 2.
+# When one argument is /dev/null and the other is not empty,
+# cat the nonempty file to stderr and return 1.
+# Otherwise, return 0.
+compare_dev_null_ ()
+{
+ test $# = 2 || return 2
+
+ if test "x$1" = x/dev/null; then
+ test -s "$2" || return 0
+ emit_diff_u_header_ "$@"; sed 's/^/+/' "$2"
+ return 1
+ fi
+
+ if test "x$2" = x/dev/null; then
+ test -s "$1" || return 0
+ emit_diff_u_header_ "$@"; sed 's/^/-/' "$1"
+ return 1
+ fi
+
+ return 2
+}
+
+if diff_out_=`exec 2>/dev/null; diff -u "$0" "$0" < /dev/null` \
+ && diff -u Makefile "$0" 2>/dev/null | grep '^[+]#!' >/dev/null; then
+ # diff accepts the -u option and does not (like AIX 7 'diff') produce an
+ # extra space on column 1 of every content line.
+ if test -z "$diff_out_"; then
+ compare_ () { diff -u "$@"; }
+ else
+ compare_ ()
+ {
+ if diff -u "$@" > diff.out; then
+ # No differences were found, but Solaris 'diff' produces output
+ # "No differences encountered". Hide this output.
+ rm -f diff.out
+ true
+ else
+ cat diff.out
+ rm -f diff.out
+ false
+ fi
+ }
+ fi
+elif diff_out_=`exec 2>/dev/null; diff -c "$0" "$0" < /dev/null`; then
+ if test -z "$diff_out_"; then
+ compare_ () { diff -c "$@"; }
+ else
+ compare_ ()
+ {
+ if diff -c "$@" > diff.out; then
+ # No differences were found, but AIX and HP-UX 'diff' produce output
+ # "No differences encountered" or "There are no differences between the
+ # files.". Hide this output.
+ rm -f diff.out
+ true
+ else
+ cat diff.out
+ rm -f diff.out
+ false
+ fi
+ }
+ fi
+elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
+ compare_ () { cmp -s "$@"; }
+else
+ compare_ () { cmp "$@"; }
+fi
+
+# Usage: compare EXPECTED ACTUAL
+#
+# Given compare_dev_null_'s preprocessing, defer to compare_ if 2 or more.
+# Otherwise, propagate $? to caller: any diffs have already been printed.
+compare ()
+{
+ # This looks like it can be factored to use a simple "case $?"
+ # after unchecked compare_dev_null_ invocation, but that would
+ # fail in a "set -e" environment.
+ if compare_dev_null_ "$@"; then
+ return 0
+ else
+ case $? in
+ 1) return 1;;
+ *) compare_ "$@";;
+ esac
+ fi
+}
+
+# An arbitrary prefix to help distinguish test directories.
+testdir_prefix_ () { printf gt; }
+
+# Run the user-overridable cleanup_ function, remove the temporary
+# directory and exit with the incoming value of $?.
+remove_tmp_ ()
+{
+ __st=$?
+ cleanup_
+ # cd out of the directory we're about to remove
+ cd "$initial_cwd_" || cd / || cd /tmp
+ chmod -R u+rwx "$test_dir_"
+ # If removal fails and exit status was to be 0, then change it to 1.
+ rm -rf "$test_dir_" || { test $__st = 0 && __st=1; }
+ exit $__st
+}
+
+# Given a directory name, DIR, if every entry in it that matches *.exe
+# contains only the specified bytes (see the case stmt below), then print
+# a space-separated list of those names and return 0. Otherwise, don't
+# print anything and return 1. Naming constraints apply also to DIR.
+find_exe_basenames_ ()
+{
+ feb_dir_=$1
+ feb_fail_=0
+ feb_result_=
+ feb_sp_=
+ for feb_file_ in $feb_dir_/*.exe; do
+ # If there was no *.exe file, or there existed a file named "*.exe" that
+ # was deleted between the above glob expansion and the existence test
+ # below, just skip it.
+ test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \
+ && continue
+ # Exempt [.exe, since we can't create a function by that name, yet
+ # we can't invoke [ by PATH search anyways due to shell builtins.
+ test "x$feb_file_" = "x$feb_dir_/[.exe" && continue
+ case $feb_file_ in
+ *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;;
+ *) # Remove leading file name components as well as the .exe suffix.
+ feb_file_=${feb_file_##*/}
+ feb_file_=${feb_file_%.exe}
+ feb_result_="$feb_result_$feb_sp_$feb_file_";;
+ esac
+ feb_sp_=' '
+ done
+ test $feb_fail_ = 0 && printf %s "$feb_result_"
+ return $feb_fail_
+}
+
+# Consider the files in directory, $1.
+# For each file name of the form PROG.exe, create an alias named
+# PROG that simply invokes PROG.exe, then return 0. If any selected
+# file name or the directory name, $1, contains an unexpected character,
+# define no alias and return 1.
+create_exe_shims_ ()
+{
+ case $EXEEXT in
+ '') return 0 ;;
+ .exe) ;;
+ *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;;
+ esac
+
+ base_names_=`find_exe_basenames_ $1` \
+ || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 0; }
+
+ if test -n "$base_names_"; then
+ for base_ in $base_names_; do
+ alias "$base_"="$base_$EXEEXT"
+ done
+ fi
+
+ return 0
+}
+
+# Use this function to prepend to PATH an absolute name for each
+# specified, possibly-$initial_cwd_-relative, directory.
+path_prepend_ ()
+{
+ while test $# != 0; do
+ path_dir_=$1
+ case $path_dir_ in
+ '') fail_ "invalid path dir: '$1'";;
+ /*) abs_path_dir_=$path_dir_;;
+ *) abs_path_dir_=$initial_cwd_/$path_dir_;;
+ esac
+ case $abs_path_dir_ in
+ *:*) fail_ "invalid path dir: '$abs_path_dir_'";;
+ esac
+ PATH="$abs_path_dir_:$PATH"
+
+ # Create an alias, FOO, for each FOO.exe in this directory.
+ create_exe_shims_ "$abs_path_dir_" \
+ || fail_ "something failed (above): $abs_path_dir_"
+ shift
+ done
+ export PATH
+}
+
+setup_ ()
+{
+ if test "$VERBOSE" = yes; then
+ # Test whether set -x may cause the selected shell to corrupt an
+ # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh
+ # from SunOS 5.11, OpenBSD 4.7 and Irix 5.x and 6.5.
+ # If enabling verbose output this way would cause trouble, simply
+ # issue a warning and refrain.
+ if $gl_set_x_corrupts_stderr_; then
+ warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr"
+ else
+ set -x
+ fi
+ fi
+
+ initial_cwd_=$PWD
+ fail=0
+
+ pfx_=`testdir_prefix_`
+ test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \
+ || fail_ "failed to create temporary directory in $initial_cwd_"
+ cd "$test_dir_" || fail_ "failed to cd to temporary directory"
+
+ # As autoconf-generated configure scripts do, ensure that IFS
+ # is defined initially, so that saving and restoring $IFS works.
+ gl_init_sh_nl_='
+'
+ IFS=" "" $gl_init_sh_nl_"
+
+ # This trap statement, along with a trap on 0 below, ensure that the
+ # temporary directory, $test_dir_, is removed upon exit as well as
+ # upon receipt of any of the listed signals.
+ for sig_ in 1 2 3 13 15; do
+ eval "trap 'Exit $(expr $sig_ + 128)' $sig_"
+ done
+}
+
+# Create a temporary directory, much like mktemp -d does.
+# Written by Jim Meyering.
+#
+# Usage: mktempd_ /tmp phoey.XXXXXXXXXX
+#
+# First, try to use the mktemp program.
+# Failing that, we'll roll our own mktemp-like function:
+# - try to get random bytes from /dev/urandom
+# - failing that, generate output from a combination of quickly-varying
+# sources and gzip. Ignore non-varying gzip header, and extract
+# "random" bits from there.
+# - given those bits, map to file-name bytes using tr, and try to create
+# the desired directory.
+# - make only $MAX_TRIES_ attempts
+
+# Helper function. Print $N pseudo-random bytes from a-zA-Z0-9.
+rand_bytes_ ()
+{
+ n_=$1
+
+ # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first?
+ # But if they have openssl, they probably have mktemp, too.
+
+ chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+ dev_rand_=/dev/urandom
+ if test -r "$dev_rand_"; then
+ # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194.
+ dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \
+ | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_
+ return
+ fi
+
+ n_plus_50_=`expr $n_ + 50`
+ cmds_='date; date +%N; free; who -a; w; ps auxww; ps ef; netstat -n'
+ data_=` (eval "$cmds_") 2>&1 | gzip `
+
+ # Ensure that $data_ has length at least 50+$n_
+ while :; do
+ len_=`echo "$data_"|wc -c`
+ test $n_plus_50_ -le $len_ && break;
+ data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip `
+ done
+
+ echo "$data_" \
+ | dd bs=1 skip=50 count=$n_ 2>/dev/null \
+ | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_
+}
+
+mktempd_ ()
+{
+ case $# in
+ 2);;
+ *) fail_ "Usage: mktempd_ DIR TEMPLATE";;
+ esac
+
+ destdir_=$1
+ template_=$2
+
+ MAX_TRIES_=4
+
+ # Disallow any trailing slash on specified destdir:
+ # it would subvert the post-mktemp "case"-based destdir test.
+ case $destdir_ in
+ /) ;;
+ */) fail_ "invalid destination dir: remove trailing slash(es)";;
+ esac
+
+ case $template_ in
+ *XXXX) ;;
+ *) fail_ \
+ "invalid template: $template_ (must have a suffix of at least 4 X's)";;
+ esac
+
+ # First, try to use mktemp.
+ d=`unset TMPDIR; { mktemp -d -t -p "$destdir_" "$template_"; } 2>/dev/null` \
+ || fail=1
+
+ # The resulting name must be in the specified directory.
+ case $d in "$destdir_"*);; *) fail=1;; esac
+
+ # It must have created the directory.
+ test -d "$d" || fail=1
+
+ # It must have 0700 permissions. Handle sticky "S" bits.
+ perms=`ls -dgo "$d" 2>/dev/null|tr S -` || fail=1
+ case $perms in drwx------*) ;; *) fail=1;; esac
+
+ test $fail = 0 && {
+ echo "$d"
+ return
+ }
+
+ # If we reach this point, we'll have to create a directory manually.
+
+ # Get a copy of the template without its suffix of X's.
+ base_template_=`echo "$template_"|sed 's/XX*$//'`
+
+ # Calculate how many X's we've just removed.
+ template_length_=`echo "$template_" | wc -c`
+ nx_=`echo "$base_template_" | wc -c`
+ nx_=`expr $template_length_ - $nx_`
+
+ err_=
+ i_=1
+ while :; do
+ X_=`rand_bytes_ $nx_`
+ candidate_dir_="$destdir_/$base_template_$X_"
+ err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \
+ && { echo "$candidate_dir_"; return; }
+ test $MAX_TRIES_ -le $i_ && break;
+ i_=`expr $i_ + 1`
+ done
+ fail_ "$err_"
+}
+
+# If you want to override the testdir_prefix_ function,
+# or to add more utility functions, use this file.
+test -f "$srcdir/init.cfg" \
+ && . "$srcdir/init.cfg"
+
+setup_ "$@"
+# This trap is here, rather than in the setup_ function, because some
+# shells run the exit trap at shell function exit, rather than script exit.
+trap remove_tmp_ 0
diff --git a/tests/msdos-overlap b/tests/msdos-overlap
new file mode 100755
index 0000000..b2b03e6
--- /dev/null
+++ b/tests/msdos-overlap
@@ -0,0 +1,24 @@
+#!/usr/bin/python3
+"""
+ 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: <image or device>" % sys.argv[0])
+ sys.exit(1)
+
+with open(sys.argv[1], "rb+") as f:
+ f.seek(OFFSET, 0)
+ f.write(bytes(bytearray(BAD_ENTRY)))
+
+sys.exit(0)
diff --git a/tests/print-align.c b/tests/print-align.c
new file mode 100644
index 0000000..e012fb3
--- /dev/null
+++ b/tests/print-align.c
@@ -0,0 +1,50 @@
+#include <config.h>
+#include <parted/parted.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "closeout.h"
+#include "progname.h"
+
+int
+main (int argc, char **argv)
+{
+ atexit (close_stdout);
+ set_program_name (argv[0]);
+
+ if (argc != 2)
+ return EXIT_FAILURE;
+
+ char const *dev_name = argv[1];
+ PedDevice *dev = ped_device_get (dev_name);
+ if (dev == NULL)
+ return EXIT_FAILURE;
+
+ PedAlignment *pa_min = ped_device_get_minimum_alignment (dev);
+ if (pa_min)
+ printf ("minimum: %lld %lld\n", pa_min->offset, pa_min->grain_size);
+ else
+ printf ("minimum: - -\n");
+ free (pa_min);
+
+ PedAlignment *pa_opt = ped_device_get_optimum_alignment (dev);
+ if (pa_opt)
+ printf ("optimal: %lld %lld\n", pa_opt->offset, pa_opt->grain_size);
+ else
+ printf ("optimal: - -\n");
+ free (pa_opt);
+
+ PedDisk *disk = ped_disk_new (dev);
+ if (disk == NULL)
+ return EXIT_FAILURE;
+
+ PedAlignment *part_align = ped_disk_get_partition_alignment (disk);
+ if (part_align == NULL)
+ return EXIT_FAILURE;
+
+ printf ("partition alignment: %lld %lld\n",
+ part_align->offset, part_align->grain_size);
+
+ ped_device_destroy (dev);
+ return EXIT_SUCCESS;
+}
diff --git a/tests/print-flags.c b/tests/print-flags.c
new file mode 100644
index 0000000..db088e8
--- /dev/null
+++ b/tests/print-flags.c
@@ -0,0 +1,58 @@
+/* Print the available flags for a particular partition. */
+
+#include <config.h>
+#include <parted/parted.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "progname.h"
+
+int
+main (int argc, char **argv)
+{
+ PedDevice *dev;
+ PedDisk *disk;
+ PedPartition *part;
+ int partnum;
+
+ set_program_name (argv[0]);
+
+ if (argc != 3 ) {
+ fprintf (stderr, "Usage: %s <device> <ptnnum>\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ dev = ped_device_get(argv[1]);
+ if (!dev) {
+ fprintf (stderr, "Error: failed to create device %s\n",
+ argv[1]);
+ return EXIT_FAILURE;
+ }
+ if (!ped_device_open (dev)) {
+ fprintf (stderr, "Error: failed to open device %s\n", argv[1]);
+ return EXIT_FAILURE;
+ }
+ disk = ped_disk_new (dev);
+ if (!disk) {
+ fprintf (stderr,
+ "Error: failed to read partition table from device %s\n",
+ argv[1]);
+ return EXIT_FAILURE;
+ }
+
+ partnum = atoi (argv[2]);
+ part = ped_disk_get_partition (disk, partnum);
+ if (!part) {
+ fprintf (stderr,
+ "Error: failed to get partition %d from device %s\n",
+ partnum, argv[1]);
+ return EXIT_FAILURE;
+ }
+
+ for (PedPartitionFlag flag = PED_PARTITION_FIRST_FLAG;
+ flag <= PED_PARTITION_LAST_FLAG; flag++)
+ {
+ if (ped_partition_is_flag_available (part, flag))
+ puts (ped_partition_flag_get_name (flag));
+ }
+ return EXIT_SUCCESS;
+}
diff --git a/tests/print-max.c b/tests/print-max.c
new file mode 100644
index 0000000..41aa8c6
--- /dev/null
+++ b/tests/print-max.c
@@ -0,0 +1,45 @@
+#include <config.h>
+#include <parted/parted.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include "closeout.h"
+#include "progname.h"
+#include "error.h"
+
+int
+main (int argc, char **argv)
+{
+ atexit (close_stdout);
+ set_program_name (argv[0]);
+
+ if (argc != 2)
+ return EXIT_FAILURE;
+
+ char const *dev_name = argv[1];
+ PedDevice *dev = ped_device_get (dev_name);
+ if (dev == NULL)
+ return EXIT_FAILURE;
+ PedDisk *disk = ped_disk_new (dev);
+ if (disk == NULL)
+ return EXIT_FAILURE;
+
+ PedSector max_length = ped_disk_max_partition_length (disk);
+ PedSector max_start_sector = ped_disk_max_partition_start_sector (disk);
+
+ if (!ped_device_open(dev))
+ error (EXIT_FAILURE, errno, "failed to open %s\n", dev_name);
+ int max_n_partitions;
+ bool ok = ped_disk_get_max_supported_partition_count (disk,
+ &max_n_partitions);
+
+ printf ("max len: %llu\n", (unsigned long long) max_length);
+ printf ("max start sector: %llu\n", (unsigned long long) max_start_sector);
+ printf ("max number of partitions: %d\n",
+ ok ? max_n_partitions : -1);
+
+ ped_disk_destroy (disk);
+ ped_device_destroy (dev);
+ return EXIT_SUCCESS;
+}
diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh
new file mode 100644
index 0000000..a1d3c30
--- /dev/null
+++ b/tests/t-lib-helpers.sh
@@ -0,0 +1,430 @@
+# Functions sourced via testing framework.
+
+getlimits_()
+{
+ eval $(getlimits)
+ test "$INT_MAX" ||
+ error_ "Error running getlimits"
+}
+
+require_acl_()
+{
+ getfacl --version < /dev/null > /dev/null 2>&1 \
+ && setfacl --version < /dev/null > /dev/null 2>&1 \
+ || skip_ "This test requires getfacl and setfacl."
+
+ id -u bin > /dev/null 2>&1 \
+ || skip_ "This test requires a local user named bin."
+}
+
+require_hfs_()
+{
+ mkfs.hfs 2>&1 | grep '^usage:' \
+ || skip_ "mkfs.hfs: command not found"
+}
+
+require_fat_()
+{
+ mkfs.vfat 2>&1 | grep '^Usage:' \
+ || skip_ "mkfs.vfat: command not found"
+}
+
+# Skip this test if we're not in SELinux "enforcing" mode.
+require_selinux_enforcing_()
+{
+ test "$(getenforce)" = Enforcing \
+ || skip_ "This test is useful only with SELinux in Enforcing mode."
+}
+
+
+require_openat_support_()
+{
+ # Skip this test if your system has neither the openat-style functions
+ # nor /proc/self/fd support with which to emulate them.
+ test -z "$CONFIG_HEADER" \
+ && skip_ 'internal error: CONFIG_HEADER not defined'
+
+ _skip=yes
+ grep '^#define HAVE_OPENAT' "$CONFIG_HEADER" > /dev/null && _skip=no
+ test -d /proc/self/fd && _skip=no
+ if test $_skip = yes; then
+ skip_ 'this system lacks openat support'
+ fi
+}
+
+require_ulimit_()
+{
+ ulimit_works=yes
+ # Expect to be able to exec a program in 10MB of virtual memory,
+ # but not in 20KB. I chose "date". It must not be a shell built-in
+ # function, so you can't use echo, printf, true, etc.
+ # Of course, in coreutils, I could use $top_builddir/src/true,
+ # but this should be able to work for other projects, too.
+ ( ulimit -v 10000; date ) > /dev/null 2>&1 || ulimit_works=no
+ ( ulimit -v 20; date ) > /dev/null 2>&1 && ulimit_works=no
+
+ test $ulimit_works = no \
+ && skip_ "this shell lacks ulimit support"
+}
+
+require_readable_root_()
+{
+ test -r / || skip_ "/ is not readable"
+}
+
+# Skip the current test if strace is not available or doesn't work
+# with the named syscall. Usage: require_strace_ unlink
+require_strace_()
+{
+ test $# = 1 || framework_failure
+
+ strace -V < /dev/null > /dev/null 2>&1 ||
+ skip_ 'no strace program'
+
+ strace -qe "$1" echo > /dev/null 2>&1 ||
+ skip_ 'strace -qe "'"$1"'" does not work'
+}
+
+# Require a controlling input `terminal'.
+require_controlling_input_terminal_()
+{
+ tty -s || have_input_tty=no
+ test -t 0 || have_input_tty=no
+ if test "$have_input_tty" = no; then
+ skip_ 'requires controlling input terminal
+This test must have a controlling input "terminal", so it may not be
+run via "batch", "at", or "ssh". On some systems, it may not even be
+run in the background.'
+ fi
+}
+
+uid_is_privileged_()
+{
+ # Make sure id -u succeeds.
+ my_uid=$(id -u) \
+ || { echo "$0: cannot run \`id -u'" 1>&2; return 1; }
+
+ # Make sure it gives valid output.
+ case $my_uid in
+ 0) ;;
+ *[!0-9]*)
+ echo "$0: invalid output (\`$my_uid') from \`id -u'" 1>&2
+ return 1 ;;
+ *) return 1 ;;
+ esac
+}
+
+get_process_status_()
+{
+ sed -n '/^State:[ ]*\([[:alpha:]]\).*/s//\1/p' /proc/$1/status
+}
+
+# Convert an ls-style permission string, like drwxr----x and -rw-r-x-wx
+# to the equivalent chmod --mode (-m) argument, (=,u=rwx,g=r,o=x and
+# =,u=rw,g=rx,o=wx). Ignore ACLs.
+rwx_to_mode_()
+{
+ case $# in
+ 1) rwx=$1;;
+ *) echo "$0: wrong number of arguments" 1>&2
+ echo "Usage: $0 ls-style-mode-string" 1>&2
+ return;;
+ esac
+
+ case $rwx in
+ [ld-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxtT-]) ;;
+ [ld-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxtT-][+.]) ;;
+ *) echo "$0: invalid mode string: $rwx" 1>&2; return;;
+ esac
+
+ # Perform these conversions:
+ # S s
+ # s xs
+ # T t
+ # t xt
+ # The `T' and `t' ones are only valid for `other'.
+ s='s/S/@/;s/s/x@/;s/@/s/'
+ t='s/T/@/;s/t/x@/;s/@/t/'
+
+ u=`echo $rwx|sed 's/^.\(...\).*/,u=\1/;s/-//g;s/^,u=$//;'$s`
+ g=`echo $rwx|sed 's/^....\(...\).*/,g=\1/;s/-//g;s/^,g=$//;'$s`
+ o=`echo $rwx|sed 's/^.......\(...\).*/,o=\1/;s/-//g;s/^,o=$//;'$s';'$t`
+ echo "=$u$g$o"
+}
+
+require_selinux_()
+{
+ case `ls -Zd .` in
+ '? .'|'unlabeled .')
+ skip_ "this system (or maybe just" \
+ "the current file system) lacks SELinux support"
+ ;;
+ esac
+}
+
+very_expensive_()
+{
+ if test "$RUN_VERY_EXPENSIVE_TESTS" != yes; then
+ skip_ 'very expensive: disabled by default
+This test is very expensive, so it is disabled by default.
+To run it anyway, rerun make check with the RUN_VERY_EXPENSIVE_TESTS
+environment variable set to yes. E.g.,
+
+ env RUN_VERY_EXPENSIVE_TESTS=yes make check
+'
+ fi
+}
+
+expensive_()
+{
+ if test "$RUN_EXPENSIVE_TESTS" != yes; then
+ skip_ 'expensive: disabled by default
+This test is relatively expensive, so it is disabled by default.
+To run it anyway, rerun make check with the RUN_EXPENSIVE_TESTS
+environment variable set to yes. E.g.,
+
+ env RUN_EXPENSIVE_TESTS=yes make check
+'
+ fi
+}
+
+require_root_()
+{
+ uid_is_privileged_ || skip_ "must be run as root"
+ NON_ROOT_USERNAME=${NON_ROOT_USERNAME=nobody}
+ NON_ROOT_GROUP=${NON_ROOT_GROUP=$(id -g $NON_ROOT_USERNAME)}
+}
+
+skip_if_root_() { uid_is_privileged_ && skip_ "must be run as non-root"; }
+error_() { echo "$0: $@" 1>&2; Exit 1; }
+framework_failure() { error_ 'failure in testing framework'; }
+
+# Set `groups' to a space-separated list of at least two groups
+# of which the user is a member.
+require_membership_in_two_groups_()
+{
+ test $# = 0 || framework_failure
+
+ groups=${COREUTILS_GROUPS-`(id -G || /usr/xpg4/bin/id -G) 2>/dev/null`}
+ case "$groups" in
+ *' '*) ;;
+ *) skip_ 'requires membership in two groups
+this test requires that you be a member of more than one group,
+but running `id -G'\'' either failed or found just one. If you really
+are a member of at least two groups, then rerun this test with
+COREUTILS_GROUPS set in your environment to the space-separated list
+of group names or numbers. E.g.,
+
+ env COREUTILS_GROUPS='users cdrom' make check
+
+'
+ ;;
+ esac
+}
+
+# Is /proc/$PID/status supported?
+require_proc_pid_status_()
+{
+ sleep 2 &
+ local pid=$!
+ sleep .5
+ grep '^State:[ ]*[S]' /proc/$pid/status > /dev/null 2>&1 ||
+ skip_ "/proc/$pid/status: missing or 'different'"
+ kill $pid
+}
+
+# Does the current (working-dir) file system support sparse files?
+require_sparse_support_()
+{
+ test $# = 0 || framework_failure
+ # Test whether we can create a sparse file.
+ # For example, on Darwin6.5 with a file system of type hfs, it's not possible.
+ # NTFS requires 128K before a hole appears in a sparse file.
+ t=sparse.$$
+ dd bs=1 seek=128K of=$t < /dev/null 2> /dev/null
+ set x `du -sk $t`
+ kb_size=$2
+ rm -f $t
+ if test $kb_size -ge 128; then
+ skip_ 'this file system does not support sparse files'
+ fi
+}
+
+mkfifo_or_skip_()
+{
+ test $# = 1 || framework_failure
+ if ! mkfifo "$1"; then
+ # Make an exception of this case -- usually we interpret framework-creation
+ # failure as a test failure. However, in this case, when running on a SunOS
+ # system using a disk NFS mounted from OpenBSD, the above fails like this:
+ # mkfifo: cannot make fifo `fifo-10558': Not owner
+ skip_ 'NOTICE: unable to create test prerequisites'
+ fi
+}
+
+# Disable the current test if the working directory seems to have
+# the setgid bit set.
+skip_if_setgid_()
+{
+ setgid_tmpdir=setgid-$$
+ (umask 77; mkdir $setgid_tmpdir)
+ perms=$(stat --printf %A $setgid_tmpdir)
+ rmdir $setgid_tmpdir
+ case $perms in
+ drwx------);;
+ drwxr-xr-x);; # Windows98 + DJGPP 2.03
+ *) skip_ 'this directory has the setgid bit set';;
+ esac
+}
+
+skip_if_mcstransd_is_running_()
+{
+ test $# = 0 || framework_failure
+
+ # When mcstransd is running, you'll see only the 3-component
+ # version of file-system context strings. Detect that,
+ # and if it's running, skip this test.
+ __ctx=$(stat --printf='%C\n' .) || framework_failure
+ case $__ctx in
+ *:*:*:*) ;; # four components is ok
+ *) # anything else probably means mcstransd is running
+ skip_ "unexpected context '$__ctx'; turn off mcstransd" ;;
+ esac
+}
+
+# Skip the current test if umask doesn't work as usual.
+# This test should be run in the temporary directory that ends
+# up being removed via the trap commands.
+working_umask_or_skip_()
+{
+ umask 022
+ touch file1 file2
+ chmod 644 file2
+ perms=`ls -l file1 file2 | sed 's/ .*//' | uniq`
+ rm -f file1 file2
+
+ case $perms in
+ *'
+ '*) skip_ 'your build directory has unusual umask semantics'
+ esac
+}
+
+emit_superuser_warning()
+{
+ uid=`id -u` || uid=1
+ test "$uid" != 0 &&
+ echo 'WARNING: You are not superuser. Watch out for permissions.' || :
+}
+
+require_mdadm_()
+{
+ mdadm --version || skip_ "find mdadm executable"
+}
+
+# Will look for an md number that is not in use and create a md device with
+# that number. If the system has more than 9 md devices, it will fail.
+mdadm_create_linear_device_()
+{
+ lo_dev=$1
+ mdd=$G_dev_/md0
+ for i in 0 1 2 3 4 5 6 7 8 9 ; do
+ mdd=$G_dev_/md$i
+ mdadm --create --force $mdd --level=linear --raid-devices=1 $lo_dev \
+ > /dev/null 2>&1 \
+ && break
+
+ if [ $i -eq 9 ]; then echo $mdd ; return 1 ; fi
+ done
+
+ echo $mdd
+ return 0
+}
+
+# Often, when parted cannot use the specified size or start/endpoints
+# of a partition, it outputs a warning or error like this:
+#
+# Error: You requested a partition from 512B to 50.7kB (...).
+# The closest location we can manage is 17.4kB to 33.8kB (...).
+#
+# But those numbers depend on sector size, so
+# replace the specific values with place-holders,
+# so tests do not depend on sector size.
+normalize_part_diag_()
+{
+ local file=$1
+ sed 's/ [0-9.k]*B to [0-9.k]*B (sectors .*$/ X to Y./' $file > $file.t \
+ && mv $file.t $file && return 0
+ return 1
+}
+
+require_xfs_()
+{
+ mkfs.xfs -V || skip_ "this test requires XFS support"
+}
+
+require_dvhtool_()
+{
+ dvhtool --help \
+ || skip_ 'dvhtool is required for this test'
+}
+
+# Helper function: wait 2s (via .1s increments) for FILE to appear.
+# Usage: wait_for_dev_to_appear_ /dev/sdg
+# Return 0 upon success, 1 upon failure.
+wait_for_dev_to_appear_()
+{
+ local file=$1
+ local i=0
+ local incr=1
+ while :; do
+ udevadm settle
+ ls "$file" > /dev/null 2>&1 && return 0
+ sleep .1 2>/dev/null || { sleep 1; incr=10; }
+ i=$(expr $i + $incr); test $i = 20 && break
+ done
+ return 1
+}
+
+# Like the above, but don't hard-code the max timeout.
+wait_for_dev_to_disappear_()
+{
+ local file=$1
+ local n_sec=$2
+ local i=0
+ local incr=1
+ while :; do
+ udevadm settle
+ ls "$file" > /dev/null 2>&1 || return 0
+ sleep .1 2>/dev/null || { sleep 1; incr=10; }
+ i=$(expr $i + $incr); test $i -ge $(expr $n_sec \* 10) && break
+ done
+ return 1
+}
+
+device_mapper_required_()
+{
+ . "$abs_top_srcdir/tests/t-lvm.sh"
+ lvm_init_root_dir_ || fail_ "device mapper setup failed"
+}
+
+# Require a 64bit system
+require_64bit_()
+{
+ case $(uname -m) in
+ aarch64|mips64|ppc64|x86_64)
+ return 0;;
+ *)
+ skip_ "This test requires a 64 bit system"
+ ;;
+ esac
+}
+
+# Check if the specified filesystem is either built into the kernel, or can be loaded
+# as a module
+# Usage: has_filesystem vfat
+# Ruturns 0 if the filesystem is available, otherwise skips the test
+require_filesystem_()
+{
+ grep $1 /proc/filesystems >/dev/null && return 0
+ modprobe --quiet --dry-run $1 || skip_ "this test requires kernel support for $1"
+}
diff --git a/tests/t-local.sh b/tests/t-local.sh
new file mode 100644
index 0000000..2ba7ee1
--- /dev/null
+++ b/tests/t-local.sh
@@ -0,0 +1,196 @@
+# Put test-related bits that are parted-specific here.
+# This file is sourced from the testing framework.
+sector_size_=${PARTED_SECTOR_SIZE:-512}
+
+scsi_debug_lock_dir_="$abs_srcdir/scsi_debug.lock"
+
+require_scsi_debug_module_()
+{
+ require_udevadm_settle_
+ # check for scsi_debug module
+ modprobe -n scsi_debug ||
+ skip_ "you lack the scsi_debug kernel module"
+}
+
+scsi_debug_modprobe_succeeded_=
+
+# Always run this cleanup function.
+cleanup_final_() { scsi_debug_cleanup_; }
+
+scsi_debug_cleanup_()
+{
+ # This function must always release the lock.
+ # If modprobe succeeded, it must be sure to run rmmod.
+ if test -n "$scsi_debug_modprobe_succeeded_"; then
+ # We have to insist. Otherwise, a single rmmod usually fails to remove it,
+ # due either to "Resource temporarily unavailable" or to
+ # "Module scsi_debug is in use".
+ i=0
+ udevadm settle
+ while [ $i -lt 40 ] ; do
+ rmmod scsi_debug \
+ && { test "$VERBOSE" = yes && warn_ $ME_ rmmod scsi_debug...; break; }
+ sleep .2 || sleep 1
+ i=$((i + 1))
+ done
+ udevadm settle
+ test $i = 40 && framework_failure_ rmmod scsi_debug failed.
+ fi
+ rm -fr $scsi_debug_lock_dir_
+}
+
+# Helper function: wait 2s (via .1s increments) for FILE to appear.
+# Usage: wait_for_dev_to_appear_ /dev/sdg
+# Return 0 upon success, 1 upon failure.
+wait_for_dev_to_appear_()
+{
+ local file=$1
+ local i=0
+ local incr=1
+ while :; do
+ udevadm settle
+ ls "$file" > /dev/null 2>&1 && return 0
+ sleep .1 2>/dev/null || { sleep 1; incr=10; }
+ i=$(expr $i + $incr); test $i = 20 && break
+ done
+ return 1
+}
+
+# Tests that uses "modprobe scsi_debug ..." must not be run in parallel.
+scsi_debug_acquire_lock_()
+{
+ local retries=20
+ local lock_timeout_stale_seconds=120
+
+ # If it was created more than $lock_timeout_stale_seconds ago, remove it.
+ # FIXME: implement this
+
+ local i=0
+ local incr=1
+ while :; do
+ mkdir "$scsi_debug_lock_dir_" && return 0
+ sleep .1 2>/dev/null || { sleep 1; incr=10; }
+ i=$(expr $i + $incr); test $i = $(expr $retries \* 10) && break
+ done
+
+ warn_ "$ME_: failed to acquire lock: $scsi_debug_lock_dir_"
+ return 1
+}
+
+# If there is a scsi_debug device, print the corresponding "sdN" and return 0.
+# Otherwise, return 1.
+new_sdX_()
+{
+ local m; m=$(grep -lw scsi_debug /sys/block/sd*/device/model) || return 1
+
+ # Remove the /sys/block/ prefix, and then the /device/model suffix.
+ m=${m#/sys/block/}
+ m=${m%/device/model}
+ echo "$m"
+ return 0
+}
+
+# Create a device using the scsi_debug module with the options passed to
+# this function as arguments. Upon success, print the name of the new device.
+scsi_debug_setup_()
+{
+ scsi_debug_acquire_lock_
+
+ # It is not trivial to determine the name of the device we're creating.
+ # Record the names of all /sys/block/sd* devices *before* probing:
+ touch stamp
+ modprobe scsi_debug opt_blks=64 "$@" || { rm -f stamp; return 1; }
+ scsi_debug_modprobe_succeeded_=1
+ test "$VERBOSE" = yes \
+ && echo $ME_ modprobe scsi_debug succeeded 1>&2
+
+ # Wait up to 2s (via .1s increments) for the list of devices to change.
+ # Sleeping for a fraction of a second requires GNU sleep, so fall
+ # back on sleeping 2x1s if that fails.
+ # FIXME-portability: using "cmp - ..." probably requires GNU cmp.
+ local incr=1
+ local i=0
+ local new_dev
+ while :; do
+ udevadm settle
+ new_dev=$(new_sdX_) && break
+ sleep .1 2>/dev/null || { sleep 1; incr=10; }
+ i=$(expr $i + $incr); test $i = 20 && break
+ done
+
+ case $new_dev in
+ sd[a-z]) ;;
+ sd[a-z][a-z]) ;;
+ *) warn_ $ME_ unexpected device name: $new_dev; return 1 ;;
+ esac
+ local t=/dev/$new_dev
+ wait_for_dev_to_appear_ $t
+ echo $t
+ return 0
+}
+
+require_512_byte_sector_size_()
+{
+ test $sector_size_ = 512 \
+ || skip_ FS test with sector size != 512
+}
+
+peek_()
+{
+ case $# in 2) ;; *) echo "usage: peek_ FILE 0_BASED_OFFSET" >&2; exit 1;; esac
+ case $2 in *[^0-9]*) echo "peek_: invalid offset: $2" >&2; exit 1 ;; esac
+ dd if="$1" bs=1 skip="$2" count=1
+}
+
+poke_()
+{
+ case $# in 3) ;; *) echo "usage: poke_ FILE 0_BASED_OFFSET BYTE" >&2; exit 1;;
+ esac
+ case $2 in *[^0-9]*) echo "poke_: invalid offset: $2" >&2; exit 1 ;; esac
+ case $3 in ?) ;; *) echo "poke_: invalid byte: '$3'" >&2; exit 1 ;; esac
+ printf %s "$3" | dd of="$1" bs=1 seek="$2" count=1 conv=notrunc
+}
+
+# byte 56 of the partition entry is the first byte of its 72-byte name field
+gpt1_pte_name_offset_()
+{
+ local ss=$1
+ case $ss in *[^0-9]*) echo "$0: invalid sector size: $ss">&2; return 1;; esac
+ expr $ss \* 2 + 56
+ return 0
+}
+
+# Change the name of the first partition in the primary GPT table,
+# thus invalidating the PartitionEntryArrayCRC32 checksum.
+gpt_corrupt_primary_table_()
+{
+ case $# in 2) ;; *) echo "$0: expected 2 args, got $#" >&2; return 1;; esac
+ local dev=$1
+ local ss=$2
+ case $ss in *[^0-9]*) echo "$0: invalid sector size: $ss">&2; return 1;; esac
+
+ # get the first byte of the name
+ local orig_pte_name_byte
+ orig_pte_name_byte=$(peek_ $dev $(gpt1_pte_name_offset_ $ss)) || return 1
+
+ local new_byte
+ test x"$orig_pte_name_byte" = xA && new_byte=B || new_byte=A
+
+ # Replace with a different byte
+ poke_ $dev $(gpt1_pte_name_offset_ $ss) "$new_byte" || return 1
+
+ printf %s "$orig_pte_name_byte"
+ return 0
+}
+
+gpt_restore_primary_table_()
+{
+ case $# in 3) ;; *) echo "$0: expected 2 args, got $#" >&2; return 1;; esac
+ local dev=$1
+ local ss=$2
+ case $ss in *[^0-9]*) echo "$0: invalid sector size: $ss">&2; return 1;; esac
+ local orig_byte=$3
+ poke_ $dev $(gpt1_pte_name_offset_ $ss) "$orig_byte" || return 1
+}
+
+. "$abs_top_srcdir/tests/t-lvm.sh"
diff --git a/tests/t-lvm.sh b/tests/t-lvm.sh
new file mode 100644
index 0000000..001523b
--- /dev/null
+++ b/tests/t-lvm.sh
@@ -0,0 +1,82 @@
+# Put lvm-related utilities here.
+# This file is sourced from test infrastructure.
+
+# Copyright (C) 2007-2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+export LVM_SUPPRESS_FD_WARNINGS=1
+
+loop_setup_()
+{
+ file=$1
+ dd if=/dev/null of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
+ || { warn_ "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
+
+ # NOTE: this requires a new enough version of losetup
+ dev=$(losetup --show -f "$file") \
+ || { warn_ "loop_setup_ failed: Unable to create loopback device"; return 1; }
+
+ echo "$dev"
+ return 0;
+}
+
+# set up private /dev and /etc
+lvm_init_root_dir_()
+{
+ test -z "$test_dir_" \
+ && skip_ "Internal error: called lvm_init_root_dir_ before" \
+ "defining \$test_dir_"
+
+ # Define these two globals.
+ G_root_=$test_dir_/root
+ G_dev_=$G_root_/dev
+
+ export LVM_SYSTEM_DIR=$G_root_/etc
+ export DM_DEV_DIR=$G_dev_
+
+ # Only the first caller does anything.
+ mkdir -p $G_root_/etc $G_dev_ $G_dev_/mapper $G_root_/lib
+ for i in 0 1 2 3 4 5 6 7; do
+ mknod $G_root_/dev/loop$i b 7 $i
+ done
+ for i in $abs_top_builddir/dmeventd/mirror/*.so \
+ $abs_top_builddir/dmeventd/snapshot/*.so
+ do
+ # NOTE: This check is necessary because the loop above will give us the
+ # value "$abs_top_builddir/dmeventd/mirror/*.so" if no files ending in
+ # 'so' exist. This is the best way I could quickly determine to skip
+ # over this bogus value.
+ if [ -f $i ]; then
+ echo Setting up symlink from $i to $G_root_/lib
+ ln -s $i $G_root_/lib
+ fi
+ done
+ cat > $G_root_/etc/lvm.conf <<-EOF
+ devices {
+ dir = "$G_dev_"
+ scan = "$G_dev_"
+ filter = [ "a/loop/", "a/mirror/", "a/mapper/", "r/.*/" ]
+ cache_dir = "$G_root_/etc"
+ sysfs_scan = 0
+ }
+ log {
+ verbose = $verboselevel
+ syslog = 0
+ indent = 1
+ }
+ backup {
+ backup = 0
+ archive = 0
+ }
+ global {
+ library_dir = "$G_root_/lib"
+ }
+EOF
+}
diff --git a/tests/t0000-basic.sh b/tests/t0000-basic.sh
new file mode 100755
index 0000000..d81dd0c
--- /dev/null
+++ b/tests/t0000-basic.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+# Ensure that a simple command using -s succeeds with no prompt
+
+# Copyright (C) 2007, 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+parted --version || fail_ 'You have not built parted yet.'
+
+# FIXME: is id -u portable enough?
+uid=`id -u` || uid=1
+
+# create a file of size N bytes
+N=1M
+dev=loop-file
+
+# create the test file
+dd if=/dev/null of=$dev bs=1 seek=$N 2> /dev/null || fail=1
+
+# run parted -s FILE mklabel msdos
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# ----------------------------------------------
+# Now, ensure that a simple mklabel command succeeds.
+# Since there's no -s option, there are prompts -- sometimes.
+
+# erase the left-over label
+dd if=/dev/zero of=$dev bs=4K count=1 conv=notrunc 2> /dev/null || fail=1
+
+# First iteration works with no prompting, since there is no preexisting label.
+# run parted mklabel (without -s) on a blank disk
+parted $dev mklabel msdos > out 2>&1 || fail=1
+
+# create expected output file
+emit_superuser_warning > exp || fail=1
+
+# check its "interactive" output
+compare exp out || fail=1
+
+# create interactive input
+printf 'y\n' > in || fail=1
+
+# Now that there's a label, rerunning the same command is interactive.
+# rerun that same command, but now with a preexisting label
+parted ---pretend-input-tty $dev mklabel msdos < in > out 2>&1 || fail=1
+
+# Transform the actual output, to avoid spurious differences when
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s,on /.*/$dev,on DEVICE,;s, * ,,g;s, $,," \
+ -e "s,^.*/lt-parted: ,parted: ," o2 > out
+
+# Create expected output file.
+{ emit_superuser_warning > exp; } || fail=1
+cat <<EOF >> exp || fail=1
+Warning: The existing disk label on DEVICE will be destroyed and all\
+ data on this disk will be lost. Do you want to continue?
+Yes/No? y
+EOF
+
+# check its output -- slightly different here, due to prompts
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0001-tiny.sh b/tests/t0001-tiny.sh
new file mode 100755
index 0000000..6a78de4
--- /dev/null
+++ b/tests/t0001-tiny.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# operate on a very small (1-sector) "disk"
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+dev=loop-file
+
+for opt in '' -s; do
+
+ dd if=/dev/null of=$dev bs=1 seek=$ss || framework_failure
+
+ # create an msdos partition table:
+ # Before parted-2.1, without -s, this would fail with a bogus diagnostic:
+ # Error: Success during read on .../tests/loop-file
+ # Retry/Ignore/Cancel? ^C
+ parted $opt $dev mklabel msdos ---pretend-input-tty </dev/null > out 2>&1 \
+ || fail=1
+ # expect no output
+ sed 's/.*WARNING: You are not superuser.*//;/^$/d' out > k && mv k out \
+ || fail=1
+ # When run as root, there are just curses-related control chars. Remove them.
+ sed 's/^.\{1,12\}$//;/^$/d' out > k && mv k out \
+ || fail=1
+ compare /dev/null out || fail=1
+
+ parted -s $dev p || fail=1
+ rm -f $dev
+
+done
+
+Exit $fail
diff --git a/tests/t0010-script-no-ctrl-chars.sh b/tests/t0010-script-no-ctrl-chars.sh
new file mode 100755
index 0000000..c62e15e
--- /dev/null
+++ b/tests/t0010-script-no-ctrl-chars.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+# Ensure that printing with -s outputs no readline control chars
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+n_sectors=5000
+dev=loop-file
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# print partition table in --script mode
+TERM=xterm parted -m -s $dev u s p > out 2>&1 || fail=1
+
+sed "s,.*/$dev:,$dev:," out > k && mv k out || fail=1
+printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:msdos::;\n" > exp || fail=1
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0100-print.sh b/tests/t0100-print.sh
new file mode 100755
index 0000000..a69daa9
--- /dev/null
+++ b/tests/t0100-print.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# the most basic 'print' test
+# Copyright (C) 2007, 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+ss=$sector_size_
+dev=loop-file
+
+{
+ cat <<EOF
+Model: (file)
+Disk .../$dev: 8s
+Sector size (logical/physical): ${ss}B/${ss}B
+Partition Table: msdos
+Disk Flags:
+
+Number Start End Size Type File system Flags
+
+EOF
+} > exp || framework_failure
+
+# Using msdos_magic='\x55\xaa' looks nicer, but isn't portable.
+# dash's builtin printf doesn't recognize such \xHH hexadecimal escapes.
+msdos_magic='\125\252'
+
+# The extra 3KB+ zero bytes at the end are to avoid triggering a failure
+# on linux-2.6.8 that's probably related to opening with O_DIRECT.
+# Note that the minimum number of appended zero bytes required to avoid
+# the failure was 3465. Here, we append a little more to make the resulting
+# file have a total size of exactly 8 sectors.
+# setup: create the most basic partition table, manually
+{ dd if=/dev/zero bs=510 count=1; printf "$msdos_magic"
+ dd if=/dev/zero bs=$(expr 8 '*' $ss - 510) count=1; } > $dev || fail=1
+
+# print the empty table
+parted -s $dev unit s print >out 2>&1 || fail=1
+
+# prepare actual and expected output
+sed 's/ $//' out > k && mv k out || fail=1 # Remove trailing blank.
+mv out o2 && sed "s,^Disk .*/$dev:,Disk .../$dev:," o2 > out || fail=1
+
+# check for expected output
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0101-print-empty.sh b/tests/t0101-print-empty.sh
new file mode 100755
index 0000000..bd328e3
--- /dev/null
+++ b/tests/t0101-print-empty.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# test 'parted $dev print' on empty device (without label)
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+ss=$sector_size_
+dev=loop-file
+
+{
+ cat <<EOF
+Error: .../$dev: unrecognised disk label
+Model: (file)
+Disk .../$dev: 8s
+Sector size (logical/physical): ${ss}B/${ss}B
+Partition Table: unknown
+Disk Flags:
+EOF
+} > exp || framework_failure
+
+# create 'empty' device
+dd if=/dev/zero of=$dev bs=$(expr 8 '*' $ss) count=1 >/dev/null 2>&1 || fail=1
+
+# print the empty table; expect nonzero exit status
+parted -s $dev unit s print >out 2>&1 && fail=1
+
+# prepare actual and expected output
+sed 's/ $//' out > k && mv k out || fail=1 # Remove trailing blank.
+mv out o2 && sed "s,^Disk .*/$dev:,Disk .../$dev:,; \
+ s,^Error: .*/$dev:,Error: .../$dev:," o2 > out || fail=1
+
+# check for expected output
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0200-gpt.sh b/tests/t0200-gpt.sh
new file mode 100755
index 0000000..cc0daaa
--- /dev/null
+++ b/tests/t0200-gpt.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Ensure that printing a GPT partition table does not modify it.
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+N=2M
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# save a copy of the original primary GPT table
+dd if=$dev of=before count=1 skip=1 || fail=1
+
+# extend the backing file by 1 byte
+printf x >> $dev || fail=1
+
+# use parted simply to print the partition table
+parted -m -s $dev u s p > out 2> err || fail=1
+# don't bother comparing stdout
+# expect no stderr
+compare /dev/null err || fail=1
+
+# extract the primary GPT table again
+dd if=$dev of=after count=1 skip=1 || fail=1
+
+# compare partition tables (they had better be identical)
+compare before after || fail=1
+
+Exit $fail
diff --git a/tests/t0201-gpt.sh b/tests/t0201-gpt.sh
new file mode 100755
index 0000000..1a90d40
--- /dev/null
+++ b/tests/t0201-gpt.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+# avoid failed assertion when creating a GPT on top of an old one for a
+# larger device
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+# create a backing file large enough for a GPT partition table
+dd if=/dev/null of=$dev seek=4001 2> /dev/null || fail=1
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# shrink the backing file
+dd if=/dev/null of=$dev seek=4000 2> /dev/null || fail=1
+
+# create a new GPT table on top of the shrunken backing file
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+Exit $fail
diff --git a/tests/t0202-gpt-pmbr.sh b/tests/t0202-gpt-pmbr.sh
new file mode 100755
index 0000000..1b475bf
--- /dev/null
+++ b/tests/t0202-gpt-pmbr.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Preserve first 446B of the Protected MBR for gpt partitions.
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+bootcode_size=446
+
+dd if=/dev/null of=$dev bs=1 seek=1M || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Fill the first $bootcode_size bytes with 0's.
+# This affects only the protective MBR, so doesn't affect validity of gpt table.
+printf %0${bootcode_size}d 0 > in || fail=1
+dd of=$dev bs=1 seek=0 count=$bootcode_size conv=notrunc < in || fail=1
+
+parted -s $dev p || fail=1
+
+# create a GPT partition table on top of the existing one.
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Extract the first $bootcode_size Bytes after GPT creation
+dd if=$dev of=after bs=1c count=$bootcode_size > /dev/null 2>&1 || fail=1
+
+# Compare the before and after
+compare in after || fail=1
+
+Exit $fail
diff --git a/tests/t0203-gpt-create-on-min-sized-device.sh b/tests/t0203-gpt-create-on-min-sized-device.sh
new file mode 100644
index 0000000..82b2a89
--- /dev/null
+++ b/tests/t0203-gpt-create-on-min-sized-device.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+# parted 3.1 and prior would exit with no diagnostic when failing
+# to create a GPT partition table on a device that was too small.
+
+# Copyright (C) 2012-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+ss=$sector_size_
+
+# Create the smallest file that can accommodate a GPT partition table.
+dd if=/dev/null of=$dev bs=$ss seek=68 || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Create a file that is 1 sector smaller, and require failure,
+# *with* a diagnostic.
+rm -f $dev
+dd if=/dev/null of=$dev bs=$ss seek=67 || framework_failure
+
+echo Error: device is too small for GPT > exp || framework_failure
+
+# Try to create a GPT partition table in too little space. This must fail.
+parted -s $dev mklabel gpt > out 2>&1 && fail=1
+# There must be a diagnostic.
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0203-gpt-shortened-device-primary-valid.sh b/tests/t0203-gpt-shortened-device-primary-valid.sh
new file mode 100755
index 0000000..91e52ed
--- /dev/null
+++ b/tests/t0203-gpt-shortened-device-primary-valid.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Demonstrate that placing a valid gpt-labeled image on a shorter device
+# does not invalidate the primary GPT header.
+
+# Copyright (C) 2012-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+dev=dev-file
+dd if=/dev/null of=$dev bs=$ss seek=100 || fail=1
+parted -s -- $dev mklabel gpt || fail=1
+
+# Chop off the last two sectors.
+dd if=/dev/null of=$dev bs=$ss seek=98 || fail=1
+printf 'ignore\nok\n' > in
+parted -m ---pretend-input-tty $dev u s p < in > out 2> err || fail=1
+
+# Remove abs name of $dev_file.
+sed "s, [^ ]*/$dev, $dev," err > k && mv k err || fail=1
+# Compare only the last line, to avoid control chars of interactive mode.
+tail -1 out > k && mv k out || fail=1
+sed "s,.*/$dev:,$dev:," out > k && mv k out || fail=1
+
+emit_superuser_warning > err.exp || fail=1
+cat <<EOF >> err.exp || fail=1
+Error: end of file while reading $dev
+Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used.
+EOF
+
+echo "$dev:98s:file:$ss:$ss:gpt::;" > out.exp || fail=1
+
+compare err.exp err || fail=1
+compare out.exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0203-gpt-tiny-device-abort.sh b/tests/t0203-gpt-tiny-device-abort.sh
new file mode 100644
index 0000000..e1aae12
--- /dev/null
+++ b/tests/t0203-gpt-tiny-device-abort.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# parted before 3.1 could abort while reading a pathologically small device
+# with a valid primary GPT header but no room for the backup header.
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+N=2M
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# truncate it to 34 sectors.
+for i in 33 34 35 67 68 69 101 102 103; do
+ dd if=$dev of=bad count=$i
+
+ # Print the partition table. Before, this would evoke a failed assertion.
+ printf 'i\no\n' > in
+ parted ---pretend-input-tty bad u s p < in > out 2> err || { fail=1; cat err; }
+ # don't bother comparing stdout
+done
+
+Exit $fail
diff --git a/tests/t0205-gpt-list-clobbers-pmbr.sh b/tests/t0205-gpt-list-clobbers-pmbr.sh
new file mode 100644
index 0000000..7bb79f9
--- /dev/null
+++ b/tests/t0205-gpt-list-clobbers-pmbr.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+# Ensure that printing a GPT partition table does not modify the pMBR.
+# Due to a bug in parted-2.1, "parted /dev/... print" would do just that.
+# Not a problem for most, but if you have a hybrid, e.g., gptsync'd
+# GPT/MBR table, merely listing the table with Parted-2.1 would clobber
+# the MBR part.
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+n_sectors=400
+dev=dev-file
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted -s $dev mklabel gpt || fail=1
+parted -s $dev mkpart p1 101s 150s || fail=1
+parted -s $dev mkpart p2 151s 200s || fail=1
+parted -s $dev mkpart p3 201s 250s || fail=1
+
+parted -m -s $dev u s p || fail=1
+
+# Write non-NUL bytes all over the MBR, so we're likely to see any change.
+# However, be careful to leave the type of the first partition, 0xEE,
+# as well as the final two magic bytes.
+printf '%0450d\xee%059d\x55\xaa' 0 0 | dd of=$dev count=1 conv=notrunc || fail=1
+
+dd if=$dev of=before count=1 || fail=1
+
+chmod a-w $dev
+parted -m -s $dev u s p || fail=1
+
+dd if=$dev of=after count=1 || fail=1
+
+cmp before after || fail=1
+
+Exit $fail
diff --git a/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh b/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh
new file mode 100755
index 0000000..6611158
--- /dev/null
+++ b/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Ensure that printing a GPT partition table does not modify the pMBR.
+# Much like t0205, but with the addition of a corrupt PTE in primary table,
+# "parted $device print" would modify $device.
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+n_sectors=400
+dev=dev-file
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted -s $dev mklabel gpt || fail=1
+parted -s $dev mkpart p1 128s 255s || fail=1
+
+parted -m -s $dev u s p || fail=1
+
+# Write non-NUL bytes all over the MBR, so we're likely to see any change.
+# However, be careful to leave the type of the first partition, 0xEE,
+# as well as the final two magic bytes.
+printf '%0450d\xee%059d\x55\xaa' 0 0 | dd of=$dev count=1 conv=notrunc || fail=1
+
+dd if=$dev of=before count=1 || fail=1
+
+orig_byte=$(gpt_corrupt_primary_table_ $dev $ss) || fail=1
+
+parted -m -s $dev u s p || fail=1
+
+dd if=$dev of=after count=1 || fail=1
+
+cmp before after || fail=1
+
+Exit $fail
diff --git a/tests/t0207-IEC-binary-notation.sh b/tests/t0207-IEC-binary-notation.sh
new file mode 100644
index 0000000..9d18ae8
--- /dev/null
+++ b/tests/t0207-IEC-binary-notation.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+# Show how parted treats a starting or ending sector number w/IEC units.
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+n_sectors=3000
+dev=dev-file
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel gpt mkpart p1 $((64*1024))B $((1024*1024-$ss))B \
+ > err 2>&1 || fail=1
+compare /dev/null err || fail=1
+parted -m -s $dev u s p > exp || fail=1
+
+# Test using MiB
+rm $dev
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel gpt mkpart p1 64KiB 1MiB \
+ > err 2>&1 || fail=1
+compare /dev/null err || fail=1
+parted -m -s $dev u s p > out || fail=1
+
+compare exp out || fail=1
+
+# Test using lower case kib and mib
+rm $dev
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel gpt mkpart p1 64kib 1mib \
+ > err 2>&1 || fail=1
+compare /dev/null err || fail=1
+parted -m -s $dev u s p > out || fail=1
+
+compare exp out || fail=1
+
+# Test using KiB
+rm $dev
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel gpt mkpart p1 64KiB 1024KiB \
+ > err 2>&1 || fail=1
+compare /dev/null err || fail=1
+parted -m -s $dev u s p > out || fail=1
+
+compare exp out || fail=1
+
+# Test using kiB
+rm $dev
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel gpt mkpart p1 64kiB 1024kiB \
+ > err 2>&1 || fail=1
+compare /dev/null err || fail=1
+parted -m -s $dev u s p > out || fail=1
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0208-mkpart-end-in-IEC.sh b/tests/t0208-mkpart-end-in-IEC.sh
new file mode 100644
index 0000000..198cccb
--- /dev/null
+++ b/tests/t0208-mkpart-end-in-IEC.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+# Make sure parted mkpart ends the partition one sector before the specified
+# value if end is specified with IEC units.
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_512_byte_sector_size_
+n_mbs=8
+dev=dev-file
+
+dd if=/dev/null of=$dev bs=1M seek=$n_mbs || fail=1
+# create 1st partition
+parted --align=none -s $dev mklabel gpt mkpart p1 1MiB 2048KiB > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+#parted -m -s $dev u s p > exp || fail=1
+
+# create 2nd partition - they should not overlap
+# this time specify default unit
+parted --align=none -s $dev unit MiB mkpart p2 2 3 > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+
+# create 3rd partition - expect no overlap
+# specify default unit, but explicitly override it
+parted --align=none -s $dev unit TB mkpart p3 3MiB 4MiB > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+
+# Specify default unit of MiB, yet use explicit ending sector number.
+parted --align=none -s $dev unit MiB mkpart p4 4MiB 10239s > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+
+# check boundaries of the partitions
+parted -m -s $dev u s p > out || fail=1
+
+# prepare expected output
+cat <<EOF > exp || framework_failure
+1:2048s:4095s:2048s::p1:;
+2:4096s:6143s:2048s::p2:;
+3:6144s:8191s:2048s::p3:;
+4:8192s:10239s:2048s::p4:;
+EOF
+
+# compare expected and actual outputs
+sed -e "1,2d" out > k; mv k out
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0209-gpt-pmbr_boot.sh b/tests/t0209-gpt-pmbr_boot.sh
new file mode 100755
index 0000000..ceecf33
--- /dev/null
+++ b/tests/t0209-gpt-pmbr_boot.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Ensure that pmbr_boot flag can be set
+
+# Copyright (C) 2012-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+N=2M
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Set the pmbr_boot flag on the PMBR
+parted -s $dev disk_set pmbr_boot on
+
+# Check to see if the flag is set
+parted -m -s $dev u s p > out 2> err || fail=1
+grep "$dev:.*:gpt::pmbr_boot;" out || { cat out; fail=1; }
+
+Exit $fail
diff --git a/tests/t0210-gpt-resized-partition-entry-array.sh b/tests/t0210-gpt-resized-partition-entry-array.sh
new file mode 100755
index 0000000..4d85f77
--- /dev/null
+++ b/tests/t0210-gpt-resized-partition-entry-array.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# exercise GPT handling of n_partition_array_entries != 128
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir
+require_perl_digest_crc_
+
+# gpt-header-munge won't work on 32bit systems
+require_64bit_
+
+ss=$sector_size_
+
+N=2M
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+gpt-header-munge --sector-size=$ss --n=9 $dev || fail=1
+
+parted -m -s $dev u s p > out 2>&1 || fail=1
+sed 's/.*:gpt:/:gpt:/' out > k && mv k out
+printf 'BYT;\n:gpt::;\n' > exp || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0211-gpt-rewrite-header.sh b/tests/t0211-gpt-rewrite-header.sh
new file mode 100644
index 0000000..d0f286f
--- /dev/null
+++ b/tests/t0211-gpt-rewrite-header.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+# exercise parted's gpt-rewriting code
+# When it encounters a GPT device with backup not at the end,
+# parted (without -s) offers to correct that by moving the backup
+# header to the end of the device. Before parted-3.1, when it attempted
+# to do that, starting with a 9-PTE array, it would render the result invalid.
+
+# Copyright (C) 2012-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir
+require_perl_digest_crc_
+
+# gpt-header-munge won't work on 32bit systems
+require_64bit_
+
+ss=$sector_size_
+
+ns=100 # Initial number of sectors.
+ns2=$((ns+64)) # Some larger number of sectors.
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=$ss seek=$ns || framework_failure
+
+# create a GPT partition table with 9 partitions in a standard 128-entry table.
+parted -a min -s $dev mklabel gpt \
+ mkpart p1 34s 34s \
+ mkpart p2 35s 35s \
+ mkpart p3 36s 36s \
+ mkpart p4 37s 37s \
+ mkpart p5 38s 38s \
+ mkpart p6 39s 39s \
+ mkpart p7 40s 40s \
+ mkpart p8 41s 41s \
+ mkpart p9 42s 42s \
+ > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Adjust the GPT table to have only 9 PTEs.
+gpt-header-munge --sector-size=$ss --n=9 $dev || fail=1
+
+# Extend size of the device.
+dd if=/dev/null of=$dev bs=$ss seek=$ns2 || fail=1
+
+printf '%s\n' f f > in || fail=1
+
+# This would always succeed, even before.
+parted ---pretend-input-tty $dev u s p < in || fail=1
+
+printf '%s\n' \
+ 'BYT;' \
+ "...:${ns2}s:file:$ss:$ss:gpt::;" \
+ '1:34s:34s:1s::p1:;' \
+ '2:35s:35s:1s::p2:;' \
+ '3:36s:36s:1s::p3:;' \
+ '4:37s:37s:1s::p4:;' \
+ '5:38s:38s:1s::p5:;' \
+ '6:39s:39s:1s::p6:;' \
+ '7:40s:40s:1s::p7:;' \
+ '8:41s:41s:1s::p8:;' \
+ '9:42s:42s:1s::p9:;' \
+ > exp || fail=1
+
+# Before parted-3.1, this would fail, reporting that both tables are corrupt.
+parted -m -s $dev u s p > out 2>&1 || fail=1
+sed '2s/^[^:]*:/...:/' out > k && mv k out
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0212-gpt-many-partitions.sh b/tests/t0212-gpt-many-partitions.sh
new file mode 100644
index 0000000..2fead57
--- /dev/null
+++ b/tests/t0212-gpt-many-partitions.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+# gpt: create many partitions
+# Before parted-3.1, this would provoke an invalid free.
+
+# Copyright (C) 2012-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir
+
+ss=$sector_size_
+
+ns=300
+n_partitions=128
+dev=dev-file
+start_sector=34
+
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=$ss seek=$ns || framework_failure
+
+cmd=
+i=1
+while :; do
+ s=$((start_sector + i - 1))
+ cmd="$cmd mkpart p$i ${s}s ${s}s"
+ test $i = $n_partitions && break; i=$((i+1))
+done
+parted -m -a min -s $dev mklabel gpt $cmd u s p > out 2>&1 || fail=1
+
+nl='
+'
+exp=$(printf '%s\n' 'BYT;' "...:${ns}s:file:$ss:$ss:gpt::;")"$nl"
+
+i=1
+while :; do
+ s=$((start_sector + i - 1))
+ exp="$exp$i:${s}s:${s}s:1s::p$i:;$nl"
+ test $i = $n_partitions && break; i=$((i+1))
+done
+printf %s "$exp" > exp || fail=1
+
+sed '2s/^[^:]*:/...:/' out > k && mv k out
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0213-mkpart-start-negative.sh b/tests/t0213-mkpart-start-negative.sh
new file mode 100755
index 0000000..27f21dd
--- /dev/null
+++ b/tests/t0213-mkpart-start-negative.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Make sure parted mkpart ends the partition one sector before the specified
+# value if end is specified with IEC units.
+
+# Copyright (C) 2011-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_512_byte_sector_size_
+n_mbs=8
+dev=dev-file
+
+dd if=/dev/null of=$dev bs=1M seek=$n_mbs || fail=1
+# start negative, end positive
+parted --align=none -s $dev -- mklabel gpt mkpart p1 -7MiB 2MiB > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+
+# start negative, end negative
+parted --align=none -s $dev -- mkpart p2 -6MiB -5MiB > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+
+# check boundaries of the partitions
+parted -m -s $dev u s p > out || fail=1
+
+# prepare expected output
+cat <<EOF > exp || framework_failure
+1:2048s:4095s:2048s::p1:;
+2:4096s:6143s:2048s::p2:;
+EOF
+
+# compare expected and actual outputs
+sed -e "1,2d" out > k; mv k out
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0215-gpt-attrs.sh b/tests/t0215-gpt-attrs.sh
new file mode 100644
index 0000000..216a966
--- /dev/null
+++ b/tests/t0215-gpt-attrs.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Test that GUID specific bits are preserved
+
+# Copyright (C) 2021 SUSE LLC
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir
+require_512_byte_sector_size_
+
+dev=loop-file
+
+# create device
+truncate --size 50MiB "$dev" || fail=1
+
+# create gpt label and one partitions
+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1
+parted --script "$dev" mkpart "test1" ext4 0% 10% > out 2>&1 || fail=1
+
+# set guid specific bit
+gpt-attrs "$dev" set 0x100000000000000 || fail=1
+
+# create additional partition
+parted --script "$dev" mkpart "test2" ext4 10% 20% > out 2>&1 || fail=1
+
+cat <<EOF > exp || fail=1
+0x100000000000000
+EOF
+
+# check guid specific bit
+gpt-attrs "$dev" show > out || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0220-gpt-msftres.sh b/tests/t0220-gpt-msftres.sh
new file mode 100755
index 0000000..160ae0f
--- /dev/null
+++ b/tests/t0220-gpt-msftres.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+# gpt default "flag" for a partition must not be msftres
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+dev=loop-file
+
+# FIXME: should be able to use "ufs" here, too, but that doesn't work.
+fs_types='
+ext2
+fat16
+fat32
+hfs
+hfs+
+hfsx
+linux-swap
+NTFS
+reiserfs
+'
+
+start=2048
+part_size=2048
+n_types=$(echo "$fs_types"|wc -w)
+
+# Create a "disk" with enough room for one partition per FS type,
+# and the overhead required for a GPT partition table.
+# 32 is the number of 512-byte sectors required to accommodate the
+# minimum size of the secondary GPT header at the end of the disk.
+n_sectors=$(expr $start + $n_types \* $part_size + 1 + 32)
+
+# create a test file large enough for one partition per FS type
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+# create a gpt partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:gpt::;\n" > exp
+i=1
+for type in $fs_types; do
+ end=$(expr $start + $part_size - 1)
+ case $type in
+ fat*|NTFS) flag=msftdata;;
+ linux-swap) flag=swap;;
+ *) flag=;;
+ esac
+ echo "$i:${start}s:${end}s:${part_size}s::$type:$flag;" >> exp || fail=1
+ parted -s $dev mkpart p-name $type ${start}s ${end}s > err 2>&1 || fail=1
+ compare /dev/null err || fail=1
+ parted -s $dev name $i $type > err 2>&1 || fail=1
+ compare /dev/null err || fail=1
+ start=$(expr $end + 1)
+ i=$(expr $i + 1)
+done
+
+# print partition table
+parted -m -s $dev u s p > out 2>&1 || fail=1
+
+sed "s,.*/$dev:,$dev:," out > k && mv k out && ok=1 || ok=0
+# match against expected output
+test $ok = 1 && { compare exp out || fail=1; }
+
+Exit $fail
diff --git a/tests/t0250-gpt.sh b/tests/t0250-gpt.sh
new file mode 100755
index 0000000..3390ca8
--- /dev/null
+++ b/tests/t0250-gpt.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# very basic GPT table
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+nb=512
+n_sectors=$(expr $nb '*' 512 / $sector_size_)
+
+# create zeroed device
+dd if=/dev/zero bs=512 count=$nb of=$dev || fail=1
+
+# create gpt label
+parted -s $dev mklabel gpt > empty 2>&1 || fail=1
+
+# ensure there was no output
+compare /dev/null empty || fail=1
+
+# print the empty table
+parted -m -s $dev unit s print > t 2>&1 || fail=1
+sed "s,.*/$dev:,$dev:," t > out || fail=1
+
+# check for expected output
+printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \
+ > exp || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh
new file mode 100755
index 0000000..a87cd36
--- /dev/null
+++ b/tests/t0251-gpt-unicode.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Test unicode partition names
+# Copyright (C) 2013-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+
+# create zeroed device
+truncate -s 10m $dev || fail=1
+
+LC_ALL=$(locale -a | grep en_US.utf8)
+if [ -z "$LC_ALL" ]; then
+ LC_ALL=C.UTF-8
+fi
+export LC_ALL="$LC_ALL"
+# create gpt label with named partition
+part_name=$(printf 'foo\341\264\244')
+parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 $part_name > empty 2>&1 || fail=1
+
+# ensure there was no output
+compare /dev/null empty || fail=1
+
+# check for expected output
+dd if=$dev bs=1 skip=$(($sector_size_+$sector_size_+56)) count=10 2>/dev/null | od -An -tx1 > out || fail=1
+echo ' 66 00 6f 00 6f 00 24 1d 00 00' >> exp
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0280-gpt-corrupt.sh b/tests/t0280-gpt-corrupt.sh
new file mode 100755
index 0000000..376de2f
--- /dev/null
+++ b/tests/t0280-gpt-corrupt.sh
@@ -0,0 +1,96 @@
+#!/bin/sh
+# corrupt a GPT table; ensure parted takes notice
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+
+ss=$sector_size_
+n_sectors=5000
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+# create gpt label
+parted -s $dev mklabel gpt > empty 2>&1 || fail=1
+compare /dev/null empty || fail=1
+
+# print the empty table
+parted -m -s $dev unit s print > t 2>&1 || fail=1
+sed "s,.*/$dev:,$dev:," t > out || fail=1
+
+# check for expected output
+printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \
+ > exp || fail=1
+compare exp out || fail=1
+
+# create a partition
+parted -s $dev mkpart sw linux-swap 2048s 4095s > empty 2>&1 || fail=1
+compare /dev/null empty || fail=1
+
+# We're going to change the name of the first partition,
+# thus invalidating the PartitionEntryArrayCRC32 checksum.
+orig_byte=$(gpt_corrupt_primary_table_ $dev $ss) || fail=1
+
+# printing the table must succeed, but with a scary diagnostic.
+parted -s $dev print > err 2>&1 || fail=1
+grep Error: err > k && mv k err || fail=1
+
+# check for expected diagnostic
+echo 'Error: The primary GPT table is corrupt, but the backup appears OK,' \
+ 'so that will be used.' > exp || fail=1
+compare exp err || fail=1
+
+# ----------------------------------------------------------
+# Now, restore things, and corrupt the MyLBA in the alternate GUID table.
+
+# Restore original byte
+gpt_restore_primary_table_ $dev $ss "$orig_byte" || fail=1
+
+# print the table
+parted -s $dev print > out 2> err || fail=1
+compare /dev/null err || fail=1
+
+# The MyLBA member of the alternate table is in the last sector,
+# $n_sectors, 8-byte field starting at offset 24.
+alt_my_lba_offset=$(expr $n_sectors \* $ss - $ss + 24)
+# get the first byte of MyLBA
+byte=$(peek_ $dev $alt_my_lba_offset) || fail=1
+
+# Perturb it.
+test x"$byte" = xA && new_byte=B || new_byte=A
+
+# Replace good byte with the bad one.
+poke_ $dev $alt_my_lba_offset "$new_byte" || fail=1
+
+# attempting to set partition name must print a diagnostic
+parted -m -s $dev name 1 foo > err 2>&1 || fail=1
+
+# check for expected diagnostic
+echo 'Error: The backup GPT table is corrupt, but the primary appears OK,' \
+ 'so that will be used.' > exp || fail=1
+compare exp err || fail=1
+
+# corruption is fixed; printing the table now elicits no diagnostic
+parted -m -s $dev u s print > out 2>&1 || fail=1
+
+# check for expected output
+printf "BYT;\nfile\n1:2048s:4095s:2048s::foo:swap;\n" > exp || fail=1
+sed "s/.*gpt::;/file/" out > k && mv k out || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0281-gpt-grow.sh b/tests/t0281-gpt-grow.sh
new file mode 100644
index 0000000..03b8486
--- /dev/null
+++ b/tests/t0281-gpt-grow.sh
@@ -0,0 +1,100 @@
+#!/bin/sh
+# grow a gpt disk, ensure that parted offers to update the gpt size
+
+# Copyright (C) 2009-2012, 2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+dev=loop-file
+
+ss=$sector_size_
+n_sectors=5000
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+# create gpt label
+parted -s $dev mklabel gpt > empty 2>&1 || fail=1
+compare /dev/null empty || fail=1
+
+# print the empty table
+parted -m -s $dev unit s print > t 2>&1 || fail=1
+sed "s,.*/$dev:,$dev:," t > out || fail=1
+
+# check for expected output
+printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \
+ > exp || fail=1
+compare exp out || fail=1
+
+# grow disk
+n_sectors=5500
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+# printing must warn, but not fix in script mode
+parted -s $dev print > out 2>&1 || fail=1
+
+# Transform the actual output, to avoid spurious differences when
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \
+ -e "s,^.*/lt-parted: ,parted: ," o2 > out
+
+# check for expected diagnostic
+cat <<EOF > exp || fail=1
+Warning: Not all of the space available to DEVICE appears to be used, you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting?
+Model: (file)
+Disk DEVICE: 2816kB
+Sector size (logical/physical): 512B/512B
+Partition Table: gpt
+Disk Flags:
+
+Number Start End Size File system Name Flags
+
+EOF
+compare exp out || fail=1
+
+# now we fix
+printf 'f\n' | parted ---pretend-input-tty $dev print > out 2>&1 || fail=1
+
+# Transform the actual output, to avoid spurious differences when
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \
+ -e "s,^.*/lt-parted: ,parted: ," o2 > out
+
+# check for expected diagnostic
+emit_superuser_warning > exp || fail=1
+cat <<EOF >> exp || fail=1
+Warning: Not all of the space available to DEVICE appears to be used, you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting?
+Fix/Ignore? f
+Model: (file)
+Disk DEVICE: 2816kB
+Sector size (logical/physical): 512B/512B
+Partition Table: gpt
+Disk Flags:
+
+Number Start End Size File system Name Flags
+
+EOF
+compare exp out || fail=1
+
+
+# Now should not warn
+
+parted -s $dev print > err 2>&1 || fail=1
+grep Warning: err > k ; mv k err
+compare /dev/null err || fail=1
+
+Exit $fail
diff --git a/tests/t0282-gpt-move-backup.sh b/tests/t0282-gpt-move-backup.sh
new file mode 100644
index 0000000..56bd0d4
--- /dev/null
+++ b/tests/t0282-gpt-move-backup.sh
@@ -0,0 +1,100 @@
+#!/bin/sh
+# put backup copy gpt in the wrong place, ensure that
+# parted offers to fix
+
+# Copyright (C) 2009-2012, 2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir
+require_512_byte_sector_size_
+dev=loop-file
+
+ss=$sector_size_
+n_sectors=5000
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+# create gpt label
+parted -s $dev mklabel gpt > empty 2>&1 || fail=1
+compare /dev/null empty || fail=1
+
+# print the empty table
+parted -m -s $dev unit s print > t 2>&1 || fail=1
+sed "s,.*/$dev:,$dev:," t > out || fail=1
+
+# check for expected output
+printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \
+ > exp || fail=1
+compare exp out || fail=1
+
+# move the backup
+gpt-header-move $dev || fail=1
+
+# printing must warn, but not fix in script mode
+parted -s $dev print > out 2>&1 || fail=1
+
+# Transform the actual output, to avoid spurious differences when
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \
+ -e "s,^.*/lt-parted: ,parted: ," o2 > out
+
+# check for expected diagnostic
+cat <<EOF > exp || fail=1
+Error: The backup GPT table is not at the end of the disk, as it should be. Fix, by moving the backup to the end (and removing the old backup)?
+Model: (file)
+Disk DEVICE: 2560kB
+Sector size (logical/physical): 512B/512B
+Partition Table: gpt
+Disk Flags:
+
+Number Start End Size File system Name Flags
+
+EOF
+compare exp out || fail=1
+
+# now we fix
+printf 'f\n' | parted ---pretend-input-tty $dev print > out 2>&1 || fail=1
+
+# Transform the actual output, to avoid spurious differences when
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \
+ -e "s,^.*/lt-parted: ,parted: ," o2 > out
+
+# check for expected diagnostic
+emit_superuser_warning > exp || fail=1
+cat <<EOF >> exp || fail=1
+Error: The backup GPT table is not at the end of the disk, as it should be. Fix, by moving the backup to the end (and removing the old backup)?
+Fix/Ignore? f
+Model: (file)
+Disk DEVICE: 2560kB
+Sector size (logical/physical): 512B/512B
+Partition Table: gpt
+Disk Flags:
+
+Number Start End Size File system Name Flags
+
+EOF
+compare exp out || fail=1
+
+
+# Now should not warn
+
+parted -s $dev print > err 2>&1 || fail=1
+grep Error: err > k ; mv k err
+compare /dev/null err || fail=1
+
+Exit $fail
diff --git a/tests/t0283-overlap-partitions.sh b/tests/t0283-overlap-partitions.sh
new file mode 100644
index 0000000..dc98203
--- /dev/null
+++ b/tests/t0283-overlap-partitions.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+# ensure parted can ignore partitions that overlap or are
+# longer than the disk and remove them
+
+# Copyright (C) 2009-2012, 2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${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
+msdos-overlap $dev || framework_failure
+
+# print the empty table
+parted ---pretend-input-tty $dev <<EOF > out 2>&1 || fail=1
+print
+ignore
+rm
+2
+EOF
+
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \
+ -e "s,^.*/lt-parted: ,parted: ," -e "s/^GNU Parted .*$/GNU Parted VERSION/" o2 > out
+
+# check for expected output
+emit_superuser_warning > exp || fail=1
+cat <<EOF >> exp || fail=1
+GNU Parted VERSION
+Using DEVICE
+Welcome to GNU Parted! Type 'help' to view a list of commands.
+(parted) print
+Error: Can't have overlapping partitions.
+Ignore/Cancel? ignore
+Model: (file)
+Disk DEVICE: 10.5MB
+Sector size (logical/physical): 512B/512B
+Partition Table: msdos
+Disk Flags:
+
+Number Start End Size Type File system Flags
+ 1 1049kB 5243kB 4194kB primary
+ 2 5242kB 8000kB 2758kB primary
+
+(parted) rm
+Partition number? 2
+(parted)
+EOF
+compare exp out || fail=1
+
+truncate -s 3m $dev || fail=1
+
+# print the table, verify error, ignore it, and remove the partition
+parted ---pretend-input-tty $dev <<EOF > out 2>&1 || fail=1
+print
+ignore
+rm
+1
+EOF
+
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \
+ -e "s,^.*/lt-parted: ,parted: ," -e "s/^GNU Parted .*$/GNU Parted VERSION/" o2 > out
+
+# check for expected output
+emit_superuser_warning > exp || fail=1
+cat <<EOF >> exp || fail=1
+GNU Parted VERSION
+Using DEVICE
+Welcome to GNU Parted! Type 'help' to view a list of commands.
+(parted) print
+Error: Can't have a partition outside the disk!
+Ignore/Cancel? ignore
+Model: (file)
+Disk DEVICE: 3146kB
+Sector size (logical/physical): 512B/512B
+Partition Table: msdos
+Disk Flags:
+
+Number Start End Size Type File system Flags
+ 1 1049kB 5243kB 4194kB primary
+
+(parted) rm
+Partition number? 1
+(parted)
+EOF
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0290-gpt-name.sh b/tests/t0290-gpt-name.sh
new file mode 100755
index 0000000..26041b6
--- /dev/null
+++ b/tests/t0290-gpt-name.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# Test setting empty GPT partition name in non-interactive mode
+
+# Copyright (C) 2021 SUSE LLC
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+
+truncate --size 50MiB "$dev" || fail=1
+
+# create partition with empty name
+parted --script "$dev" mklabel gpt mkpart '""' ext4 1MiB 49MiB > out 2>&1 || fail=1
+parted --script --machine "$dev" unit MiB print > out 2>&1 || fail=1
+grep 'MiB:::;' out || fail=1
+
+# set a non-empty name
+parted --script "$dev" name 1 "test" > out 2>&1 || fail=1
+parted --script --machine "$dev" unit MiB print > out 2>&1 || fail=1
+grep 'MiB::test:;' out || fail=1
+
+# set empty name
+parted --script "$dev" name 1 "''" > out 2>&1 || fail=1
+parted --script --machine "$dev" unit MiB print > out 2>&1 || fail=1
+grep 'MiB:::;' out || fail=1
+
+Exit $fail
diff --git a/tests/t0300-dos-on-gpt.sh b/tests/t0300-dos-on-gpt.sh
new file mode 100755
index 0000000..001af23
--- /dev/null
+++ b/tests/t0300-dos-on-gpt.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# avoid segfault creating a dos PT on top of a gpt one
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+dev=loop-file
+# create a backing file large enough for a GPT partition table
+dd if=/dev/null of=$dev bs=$ss seek=80 2> /dev/null || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# create a DOS partition table on top of it
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+Exit $fail
diff --git a/tests/t0301-overwrite-gpt-pmbr.sh b/tests/t0301-overwrite-gpt-pmbr.sh
new file mode 100755
index 0000000..90b318d
--- /dev/null
+++ b/tests/t0301-overwrite-gpt-pmbr.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Test creating a msdos partition over a GPT partition with
+# fdisk which doesn't remove the GPT partitions, only the PMBR
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+dev=loop-file
+
+# Create a GPT partition table.
+dd if=/dev/null of=$dev bs=$ss seek=80 2> /dev/null || framework_failure
+parted -s $dev mklabel gpt > out 2>&1 || framework_failure_
+compare /dev/null out || framework_failure_
+
+# Create an MSDOS partition table in another file.
+dd if=/dev/null of=m bs=$ss seek=80 2> /dev/null || framework_failure
+parted -s m mklabel msdos > out 2>&1 || framework_failure_
+compare /dev/null out || framework_failure_
+
+# Transplant the MSDOS MBR into the GPT-formatted image.
+dd if=m of=$dev bs=$ss count=1 conv=notrunc || framework_failure_
+
+# Now, try to create a GPT partition table in $dev.
+# Before, parted would prompt, asking about the apparent inconsistency.
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+Exit $fail
diff --git a/tests/t0350-mac-PT-increases-sector-size.sh b/tests/t0350-mac-PT-increases-sector-size.sh
new file mode 100644
index 0000000..b065728
--- /dev/null
+++ b/tests/t0350-mac-PT-increases-sector-size.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# With parted-3.1, a MAC partition table that specified a sector size (B)
+# larger than what the kernel told us (SS) would cause parted to read B
+# bytes into a smaller, SS-byte buffer, clobbering heap storage.
+
+# Copyright (C) 2012-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+ss=$sector_size_
+
+dd if=/dev/null of=$dev bs=$ss seek=2000 || framework_failure
+parted -s $dev mklabel mac > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Poke a big-endian 1024 into the 2-byte block_size slot.
+perl -e 'print pack("S>", 1024)'|dd of=$dev bs=1 seek=2 count=2 conv=notrunc \
+ || fail=1
+
+printf 'ignore\ncancel\n' > in || framework_failure
+
+cat <<EOF > exp
+BYT;
+FILE:2000s:file:1024:512:unknown::;
+EOF
+
+parted -m ---pretend-input-tty $dev u s p < in > err 2>&1 || fail=1
+sed 's, * ,,g;s!^/[^:]*:!FILE:!' err \
+ | grep -Evi '^(ignore|fix|error|warning)' \
+ > k && mv k err || fail=1
+compare exp err || fail=1
+
+Exit $fail
diff --git a/tests/t0400-loop-clobber-infloop.sh b/tests/t0400-loop-clobber-infloop.sh
new file mode 100644
index 0000000..6f6dbc6
--- /dev/null
+++ b/tests/t0400-loop-clobber-infloop.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+# do not infloop in loop_clobber
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+( mkswap -V ) >/dev/null 2>&1 || skip_ "no mkswap program"
+
+N=1M
+dev=loop-file
+
+cleanup_() {
+ rm -f $dev;
+}
+
+dd if=/dev/zero of=$dev bs=$N count=1 || fail=1
+
+mkswap $dev || fail=1
+
+# There was a small interval (no release) during which this would infloop.
+# create a dos partition table
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+
+compare /dev/null out || fail=1
+
+Exit $fail
diff --git a/tests/t0500-dup-clobber.sh b/tests/t0500-dup-clobber.sh
new file mode 100644
index 0000000..cd9081c
--- /dev/null
+++ b/tests/t0500-dup-clobber.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# Drive the dup-clobber program.
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+PATH="..:$PATH"
+export PATH
+
+dup-clobber || fail=1
+
+Exit $fail
diff --git a/tests/t0501-duplicate.sh b/tests/t0501-duplicate.sh
new file mode 100644
index 0000000..1beb345
--- /dev/null
+++ b/tests/t0501-duplicate.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Drive the dup-clobber program.
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted .
+
+for t in msdos gpt bsd sun atari mac pc98; do
+ case $t in
+ atari) [ $ss -ne 512 ] && continue
+ ;;
+ *) duplicate $t || fail=1
+ ;;
+ esac
+done
+
+Exit $fail
diff --git a/tests/t0800-json-gpt.sh b/tests/t0800-json-gpt.sh
new file mode 100755
index 0000000..f6a3fb9
--- /dev/null
+++ b/tests/t0800-json-gpt.sh
@@ -0,0 +1,99 @@
+#!/bin/sh
+
+# Test JSON output with GPT label
+
+# Copyright (C) 2021 SUSE LLC
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+
+# create device
+truncate --size 50MiB "$dev" || fail=1
+
+# create gpt label and some partitions
+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1
+parted --script "$dev" disk_set pmbr_boot on > out 2>&1 || fail=1
+parted --script "$dev" mkpart "test1" ext4 10% 20% > out 2>&1 || fail=1
+parted --script "$dev" mkpart "test2" xfs 20% 60% > out 2>&1 || fail=1
+parted --script "$dev" set 2 raid on > out 2>&1 || fail=1
+
+# print with json format, replace non-deterministic uuids
+parted --script --json "$dev" unit s print free | sed -E 's/"uuid": "[0-9a-f-]{36}"/"uuid": "<uuid>"/' > out 2>&1 || fail=1
+
+cat <<EOF > exp || fail=1
+{
+ "disk": {
+ "path": "loop-file",
+ "size": "102400s",
+ "model": "",
+ "transport": "file",
+ "logical-sector-size": 512,
+ "physical-sector-size": 512,
+ "label": "gpt",
+ "uuid": "<uuid>",
+ "max-partitions": 128,
+ "flags": [
+ "pmbr_boot"
+ ],
+ "partitions": [
+ {
+ "number": 0,
+ "start": "34s",
+ "end": "10239s",
+ "size": "10206s",
+ "type": "free"
+ },{
+ "number": 1,
+ "start": "10240s",
+ "end": "20479s",
+ "size": "10240s",
+ "type": "primary",
+ "type-uuid": "0fc63daf-8483-4772-8e79-3d69d8477de4",
+ "uuid": "<uuid>",
+ "name": "test1"
+ },{
+ "number": 2,
+ "start": "20480s",
+ "end": "61439s",
+ "size": "40960s",
+ "type": "primary",
+ "type-uuid": "a19d880f-05fc-4d3b-a006-743f0f84911e",
+ "uuid": "<uuid>",
+ "name": "test2",
+ "flags": [
+ "raid"
+ ]
+ },{
+ "number": 0,
+ "start": "61440s",
+ "end": "102366s",
+ "size": "40927s",
+ "type": "free"
+ }
+ ]
+ }
+}
+EOF
+
+# remove full path of device from actual output
+mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1
+
+# check for expected output
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0801-json-msdos.sh b/tests/t0801-json-msdos.sh
new file mode 100755
index 0000000..c5446d8
--- /dev/null
+++ b/tests/t0801-json-msdos.sh
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+# Test JSON output with MS-DOS label
+
+# Copyright (C) 2021 SUSE LLC
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+
+# create device
+truncate --size 50MiB "$dev" || fail=1
+
+# create msdos label and some partitions
+parted --script "$dev" mklabel msdos > out 2>&1 || fail=1
+parted --script "$dev" mkpart primary ext4 10% 20% > out 2>&1 || fail=1
+parted --script "$dev" mkpart extended 20% 60% > out 2>&1 || fail=1
+parted --script "$dev" mkpart logical ext4 20% 40% > out 2>&1 || fail=1
+parted --script "$dev" set 5 lvm on > out 2>&1 || fail=1
+
+# print with json format
+parted --script --json "$dev" unit MiB print > out 2>&1 || fail=1
+
+cat <<EOF > exp || fail=1
+{
+ "disk": {
+ "path": "loop-file",
+ "size": "50.0MiB",
+ "model": "",
+ "transport": "file",
+ "logical-sector-size": 512,
+ "physical-sector-size": 512,
+ "label": "msdos",
+ "max-partitions": 4,
+ "partitions": [
+ {
+ "number": 1,
+ "start": "5.00MiB",
+ "end": "10.0MiB",
+ "size": "5.00MiB",
+ "type": "primary",
+ "type-id": "0x83"
+ },{
+ "number": 2,
+ "start": "10.0MiB",
+ "end": "30.0MiB",
+ "size": "20.0MiB",
+ "type": "extended",
+ "type-id": "0x0f",
+ "flags": [
+ "lba"
+ ]
+ },{
+ "number": 5,
+ "start": "10.0MiB",
+ "end": "20.0MiB",
+ "size": "10.0MiB",
+ "type": "logical",
+ "type-id": "0x8e",
+ "flags": [
+ "lvm"
+ ]
+ }
+ ]
+ }
+}
+EOF
+
+# remove full path of device from actual output
+mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1
+
+# check for expected output
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0900-type-gpt.sh b/tests/t0900-type-gpt.sh
new file mode 100755
index 0000000..03febba
--- /dev/null
+++ b/tests/t0900-type-gpt.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# Test type command with GPT label
+
+# Copyright (C) 2022 SUSE LLC
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+
+# create device
+truncate --size 50MiB "$dev" || fail=1
+
+# create gpt label and one partition
+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1
+parted --script "$dev" mkpart "''" "linux-swap" 10% 20% > out 2>&1 || fail=1
+
+# set type-uuid
+parted --script "$dev" type 1 "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f" || fail=1
+
+# print with json format, replace non-deterministic uuids
+parted --script --json "$dev" unit s print | sed -E 's/"uuid": "[0-9a-f-]{36}"/"uuid": "<uuid>"/' > out 2>&1 || fail=1
+
+cat <<EOF > exp || fail=1
+{
+ "disk": {
+ "path": "loop-file",
+ "size": "102400s",
+ "model": "",
+ "transport": "file",
+ "logical-sector-size": 512,
+ "physical-sector-size": 512,
+ "label": "gpt",
+ "uuid": "<uuid>",
+ "max-partitions": 128,
+ "partitions": [
+ {
+ "number": 1,
+ "start": "10240s",
+ "end": "20479s",
+ "size": "10240s",
+ "type": "primary",
+ "type-uuid": "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f",
+ "uuid": "<uuid>"
+ }
+ ]
+ }
+}
+EOF
+
+# remove full path of device from actual output
+mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1
+
+# check for expected output
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0901-type-gpt-invalid.sh b/tests/t0901-type-gpt-invalid.sh
new file mode 100755
index 0000000..681df3a
--- /dev/null
+++ b/tests/t0901-type-gpt-invalid.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Test type command with GPT label
+
+# Copyright (C) 2022 SUSE LLC
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+
+# create device
+truncate --size 50MiB "$dev" || fail=1
+
+# create gpt label and one partition
+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1
+parted --script "$dev" mkpart "''" "linux-swap" 10% 20% > out 2>&1 || fail=1
+
+# set type-uuid
+parted --script "$dev" type 1 "invalidd-a4ab-43c4-84e5-0933c84b4f4f" && fail=1
+
+Exit $fail
diff --git a/tests/t0910-type-dos.sh b/tests/t0910-type-dos.sh
new file mode 100755
index 0000000..d7cc37f
--- /dev/null
+++ b/tests/t0910-type-dos.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# Test type command with MS-DOS label
+
+# Copyright (C) 2022 SUSE LLC
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+
+# create device
+truncate --size 50MiB "$dev" || fail=1
+
+# create msdos label and one partition
+parted --script "$dev" mklabel msdos > out 2>&1 || fail=1
+parted --script "$dev" mkpart primary "linux-swap" 10% 20% > out 2>&1 || fail=1
+
+# set type-id
+parted --script "$dev" type 1 "0x83" || fail=1
+
+# print with json format
+parted --script --json "$dev" unit s print > out 2>&1 || fail=1
+
+cat <<EOF > exp || fail=1
+{
+ "disk": {
+ "path": "loop-file",
+ "size": "102400s",
+ "model": "",
+ "transport": "file",
+ "logical-sector-size": 512,
+ "physical-sector-size": 512,
+ "label": "msdos",
+ "max-partitions": 4,
+ "partitions": [
+ {
+ "number": 1,
+ "start": "10240s",
+ "end": "20479s",
+ "size": "10240s",
+ "type": "primary",
+ "type-id": "0x83"
+ }
+ ]
+ }
+}
+EOF
+
+# remove full path of device from actual output
+mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1
+
+# check for expected output
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t0911-type-dos-invalid.sh b/tests/t0911-type-dos-invalid.sh
new file mode 100755
index 0000000..f1036d1
--- /dev/null
+++ b/tests/t0911-type-dos-invalid.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Test type command with MS-DOS label
+
+# Copyright (C) 2022 SUSE LLC
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+
+# create device
+truncate --size 50MiB "$dev" || fail=1
+
+# create msdos label and one partition
+parted --script "$dev" mklabel msdos > out 2>&1 || fail=1
+parted --script "$dev" mkpart primary "linux-swap" 10% 20% > out 2>&1 || fail=1
+
+# set type-id
+parted --script "$dev" type 1 "0x101" && fail=1
+
+Exit $fail
diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh
new file mode 100755
index 0000000..e1a8bb9
--- /dev/null
+++ b/tests/t1100-busy-label.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+# partitioning (parted -s DEV mklabel) a busy disk must fail.
+
+# Copyright (C) 2007-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_root_
+require_scsi_debug_module_
+require_fat_
+require_filesystem_ vfat
+
+ss=$sector_size_
+
+scsi_debug_setup_ sector_size=$ss dev_size_mb=10 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+dev=$(cat dev-name)
+
+parted -s "$dev" mklabel msdos mkpart primary fat32 1 4 > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+wait_for_dev_to_appear_ ${dev}1 || fail=1
+mkfs.vfat ${dev}1 || fail=1
+
+mount_point="`pwd`/mnt"
+
+# Be sure to unmount upon interrupt, failure, etc.
+cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; }
+
+# create mount point dir. and mount the just-created partition on it
+mkdir $mount_point || fail=1
+mount "${dev}1" $mount_point || fail=1
+
+# now that a partition is mounted, mklabel attempt must fail
+parted -s "$dev" mklabel msdos > out 2>&1; test $? = 1 || fail=1
+
+# create expected output file
+echo "Error: Partition(s) on $dev are being used." > exp
+compare exp out || fail=1
+
+# Adding a partition must succeed, even though another
+# on this same device is mounted (active).
+parted -s "$dev" mkpart primary fat32 5 10 > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+parted -s "$dev" u s print
+
+# ==================================================
+# Repeat the test in interactive mode.
+# create input file
+echo c > in
+
+# as above, this mklabel attempt must fail
+parted ---pretend-input-tty "$dev" mklabel msdos < in > out 2>&1
+test $? = 1 || fail=1
+
+cat <<EOF > exp || fail=1
+Warning: Partition(s) on $dev are being used.
+Ignore/Cancel? c
+EOF
+
+# Transform the actual output, removing ^M ...^M.
+# normalize the actual output
+mv out o2 && sed -e 's, * ,,g;s, $,,;s/^.*Warning/Warning/' \
+ -e 's,^.*/lt-parted: ,parted: ,' o2 > out
+
+# check for expected failure diagnostic
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t1101-busy-partition.sh b/tests/t1101-busy-partition.sh
new file mode 100755
index 0000000..cb66b4a
--- /dev/null
+++ b/tests/t1101-busy-partition.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+# test for Debian bug #582818 (http://bugs.debian.org/582818); forbid
+# the removal of a mounted partition.
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+test "$VERBOSE" = yes && parted --version
+
+require_root_
+require_scsi_debug_module_
+require_fat_
+require_filesystem_ vfat
+
+# create memory-backed device
+scsi_debug_setup_ dev_size_mb=10 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+dev=$(cat dev-name)
+
+cat <<EOF > exp-error || framework_failure
+Warning: Partition ${dev}2 is being used. Are you sure you want to continue?
+EOF
+
+parted -s "$dev" mklabel msdos > out 2>&1 || fail=1
+
+# expect no output
+compare /dev/null out || fail=1
+
+parted -s "$dev" mkpart primary fat32 1 4 > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+parted -s "$dev" mkpart primary fat32 4 10 > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# wait for new partition device to appear
+wait_for_dev_to_appear_ ${dev}2 || fail_ ${dev}2 did not appear
+
+mkfs.vfat -F 32 ${dev}2 || skip_ mkfs.vfat failed
+
+# be sure to unmount upon interrupt, failure, etc.
+cleanup_fn_() { umount "${dev}2" > /dev/null 2>&1; }
+
+mount_point=$(pwd)/mnt
+
+mkdir $mount_point || fail=1
+mount "${dev}2" "$mount_point" || fail=1
+
+# Removal of unmounted partition must succeed.
+parted -s "$dev" rm 1 > out 2>&1 || fail=1
+
+# Removal of mounted partition must fail.
+parted -s "$dev" rm 2 > out 2>&1 && fail=1
+
+# expect error
+compare exp-error out || fail=1
+
+Exit $fail
diff --git a/tests/t1102-loop-label.sh b/tests/t1102-loop-label.sh
new file mode 100644
index 0000000..1ad4ccd
--- /dev/null
+++ b/tests/t1102-loop-label.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+# make sure that loop labels work correctly
+# create an actual partition
+
+# Copyright (C) 2013-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+path_prepend_ ../partprobe
+require_root_
+require_scsi_debug_module_
+ss=$sector_size_
+
+scsi_debug_setup_ sector_size=$ss dev_size_mb=10 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+dev=$(cat dev-name)
+
+mke2fs -F $dev
+parted -s "$dev" print > out 2>&1 || fail=1
+cat <<EOF > exp
+Model: Linux scsi_debug (scsi)
+Disk DEVICE: 10.5MB
+Sector size (logical/physical): ${ss}B/${ss}B
+Partition Table: loop
+Disk Flags:
+
+Number Start End Size File system Flags
+ 1 0.00B 10.5MB 10.5MB ext2
+
+EOF
+mv out o2 && sed -e "s,$dev,DEVICE,;s/ *$//" o2 > out
+
+compare exp out || fail=1
+parted -s $dev rm 1 || fail=1
+wait_for_dev_to_disappear_ ${dev}1 2 || fail=1
+partprobe $dev || fail=1
+wait_for_dev_to_disappear_ ${dev}1 2 || fail=1
+
+mount_point="`pwd`/mnt"
+
+# Be sure to unmount upon interrupt, failure, etc.
+cleanup_fn_() { umount "$mount_point" > /dev/null 2>&1; }
+
+# create mount point dir. and mount the just-created partition on it
+mkdir $mount_point || fail=1
+mount -t ext2 "${dev}" $mount_point || fail=1
+
+# now that a partition is mounted, mklabel attempt must fail
+parted -s "$dev" mklabel msdos > out 2>&1; test $? = 1 || fail=1
+
+# create expected output file
+echo "Error: Partition(s) on $dev are being used." > exp
+compare exp out || fail=1
+
+# make sure partition busy check works ( mklabel checks whole disk )
+parted -s "$dev" rm 1 > out 2>&1; test $? = 1 || fail=1
+# create expected output file
+echo "Warning: Partition ${dev} is being used. Are you sure you want to continue?" > exp
+compare exp out || fail=1
+
+umount "$mount_point"
+
+# make sure partprobe cleans up stale partition devices
+parted -s $dev mklabel msdos mkpart primary ext2 0% 100% || fail=1
+wait_for_dev_to_appear_ ${dev}1 || fail=1
+
+mke2fs -F $dev
+partprobe $dev || fail=1
+wait_for_dev_to_disappear_ ${dev}1 2 || fail=1
+
+# make sure new loop label removes old partitions > 1
+parted -s $dev mklabel msdos mkpart primary ext2 0% 50% mkpart primary ext2 50% 100% || fail=1
+parted -s $dev mklabel loop || fail=1
+wait_for_dev_to_disappear_ ${dev}2 2 || fail=1
+
+Exit $fail
diff --git a/tests/t1104-remove-and-add-partition.sh b/tests/t1104-remove-and-add-partition.sh
new file mode 100644
index 0000000..657b180
--- /dev/null
+++ b/tests/t1104-remove-and-add-partition.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+# make sure that removing a higher numbered partition and adding a lower
+# one using that space at the same time works
+
+# Copyright (C) 2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+path_prepend_ ../partprobe
+require_root_
+ss=$sector_size_
+
+d1= f1=
+cleanup_fn_()
+{
+ test -n "$d1" && losetup -d "$d1"
+ rm -f "$f1"
+}
+
+f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
+ || skip_ "is this partition mounted with 'nodev'?"
+
+require_partitionable_loop_device_ $d1
+
+# create one big partition
+parted -s $d1 mklabel msdos mkpart primary ext2 1m 10m || fail=1
+
+# save this table
+dd if=$d1 of=saved count=1 || fail=1
+
+# create two small partitions
+parted -s $d1 mklabel msdos mkpart primary ext2 1m 5m mkpart primary ext2 5m 10m || fail=1
+
+# restore first table and make sure partprobe works
+dd if=saved of=$d1 || fail=1
+partprobe $d1 || fail=1
+
+Exit $fail
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
new file mode 100755
index 0000000..7557f92
--- /dev/null
+++ b/tests/t1700-probe-fs.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+# Probe Ext2, Ext3 and Ext4 file systems
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+ss=$sector_size_
+n_sectors=$((512*1024))
+
+for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus udf f2fs; do
+
+ ( mkfs.$type 2>&1 | grep -i '^usage' ) > /dev/null \
+ || { warn_ "$ME: no $type support"; continue; }
+
+ fsname=$type
+ force=
+ case $type in
+ ext*) force=-F;;
+ xfs) force=-f;;
+ nilfs2) force=-f;;
+ ntfs) force=-F;;
+ vfat) fsname=fat16;;
+ hfsplus) fsname=hfs+;;
+ esac
+
+ # create an $type file system, creation failures are not parted bugs,
+ # skip the filesystem instead of failing the test.
+ if [ "$type" = "xfs" ]; then
+ # XFS requires at least 300M which is > 1024 sectors with 8192b sector size
+ mkfs.xfs -ssize=$ss -dfile,name=$dev,size=300m || { warn_ "$ME: mkfs.$type failed, skipping"; continue; }
+ else
+ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || { warn_ "$ME: dd failed, skipping $type"; continue; }
+ mkfs.$type $force $dev || { warn_ "$ME: mkfs.$type failed skipping"; continue; }
+ fi
+
+ # probe the $type file system
+ parted -m -s $dev u s print >out 2>&1 || fail=1
+ grep '^1:.*:'$fsname'::;$' out || { cat out; fail=1; }
+ rm $dev
+done
+
+# Some features should indicate ext4 by themselves.
+for feature in uninit_bg flex_bg; do
+ # create an ext3 file system
+ dd if=/dev/null of=$dev bs=1024 seek=8192 >/dev/null || skip_ "dd failed"
+ mkfs.ext3 -F $dev >/dev/null || skip_ "mkfs.ext3 failed"
+
+ # set the feature
+ tune2fs -O $feature $dev || skip_ "tune2fs failed"
+
+ # probe the file system, which should now be ext4
+ parted -m -s $dev u s print >out 2>&1 || fail=1
+ grep '^1:.*:ext4::;$' out || fail=1
+ rm $dev
+done
+
+Exit $fail
diff --git a/tests/t1701-rescue-fs.sh b/tests/t1701-rescue-fs.sh
new file mode 100644
index 0000000..90ec684
--- /dev/null
+++ b/tests/t1701-rescue-fs.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+# rescue ext4 file system
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+require_root_
+require_scsi_debug_module_
+
+# create memory-backed device
+scsi_debug_setup_ sector_size=$sector_size_ dev_size_mb=10 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+( mkfs.ext4 2>&1 | grep -i '^usage' ) > /dev/null \
+ || { warn_ "$ME: no ext4 support"; Exit $fail; }
+
+parted -s $scsi_dev mklabel msdos mkpart primary ext2 1m 100%
+wait_for_dev_to_appear_ ${scsi_dev}1 || fail=1
+mkfs.ext4 ${scsi_dev}1 || { warn_ $ME: mkfs.ext4 failed; fail=1; Exit $fail; }
+
+# remove the partition
+parted -s $scsi_dev rm 1 || fail=1
+
+# rescue the partition
+echo yes | parted ---pretend-input-tty $scsi_dev rescue 1m 100% > out 2>&1
+cat > exp <<EOF
+Information: A ext4 primary partition was found at 1049kB -> 10.5MB. Do you want to add it to the partition table?
+Yes/No/Cancel? yes
+Information: You may need to update /etc/fstab.
+EOF
+# Transform the actual output, to avoid spurious differences when
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s, * ,,g;s, $,," \
+ -e "s,^.*/lt-parted: ,parted: ," o2 > out
+echo '' >> exp
+compare exp out || fail=1
+Exit $fail
diff --git a/tests/t2200-dos-label-recog.sh b/tests/t2200-dos-label-recog.sh
new file mode 100755
index 0000000..92b8a5e
--- /dev/null
+++ b/tests/t2200-dos-label-recog.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# improved MSDOS partition-table recognition
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+######################################################################
+# With vestiges of a preceding FAT file system boot sector in the MBR,
+# parted 1.8.8.1.29 and earlier would fail to recognize a DOS
+# partition table.
+######################################################################
+ss=$sector_size_
+N=8192
+dev=loop-file
+
+# create a file to simulate the underlying device
+dd if=/dev/null of=$dev bs=$ss seek=$N 2> /dev/null || fail=1
+
+# label the test disk
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+compare /dev/null out || fail=1 # expect no output
+
+# create two partitions
+parted -s $dev mkpart primary 2048s 4095s \
+ mkpart primary 4096s 8191s > out 2>&1 || fail=1
+compare /dev/null out || fail=1 # expect no output
+
+# write "FAT" where it would cause trouble
+printf FAT | dd bs=1c seek=82 count=3 of=$dev conv=notrunc || fail=1
+
+# print the partition table
+parted -m -s $dev unit s p > out || fail=1
+tail -2 out > k && mv k out || fail=1
+printf "1:2048s:4095s:2048s:::;\n2:4096s:8191s:4096s:::;\n" > exp || fail=1
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t2201-pc98-label-recog.sh b/tests/t2201-pc98-label-recog.sh
new file mode 100755
index 0000000..be44952
--- /dev/null
+++ b/tests/t2201-pc98-label-recog.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Recognize PC98 labeled disks
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_512_byte_sector_size_
+
+ss=$sector_size_
+N=8192
+dev=loop-file
+
+# create a file to simulate the underlying device
+dd if=/dev/null of=$dev bs=$ss seek=$N 2> /dev/null || fail=1
+
+# label the test disk
+parted -s $dev mklabel pc98 > out 2>&1 || fail=1
+compare /dev/null out || fail=1 # expect no output
+
+parted -s $dev p | grep "^Partition Table: pc98" || fail=1
+
+for s in "Linux 98" "GRUB/98 "; do
+ printf "$s" | dd bs=1c seek=4 of=$dev conv=notrunc || fail=1
+ parted -s $dev p | grep "^Partition Table: pc98" || fail=1
+done
+
+Exit $fail
diff --git a/tests/t2300-dos-label-extended-bootcode.sh b/tests/t2300-dos-label-extended-bootcode.sh
new file mode 100755
index 0000000..e3dfaf7
--- /dev/null
+++ b/tests/t2300-dos-label-extended-bootcode.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+# Ensure parted preserves bootcode in extended partition.
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_512_byte_sector_size_
+
+dev=loop-file
+bootcode_size=446
+
+# Create the test file
+dd if=/dev/zero of=$dev bs=1M count=4 || fail=1
+
+# Create msdos label
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+compare /dev/null out || fail=1 # Expect no output
+
+# Create extended partition
+parted -s $dev mkpart extended 2048s 8191s > out 2>&1 || fail=1
+compare /dev/null out || fail=1 # Expect no output
+
+# Create logical partition
+parted -s $dev mkpart logical 4096s 8191s > out 2>&1 || fail=1
+compare /dev/null out || fail=1 # Expect no output
+
+# Install fake bootcode
+printf %0${bootcode_size}d 0 > in || fail=1
+dd if=in of=$dev bs=1c seek=1M count=$bootcode_size \
+ conv=notrunc > /dev/null 2>&1 || fail=1
+
+# Save fake bootcode for later comparison
+dd if=$dev of=before bs=1 skip=1M count=$bootcode_size || fail=1
+
+# Do something to the label
+parted -s $dev rm 5 > out 2>&1 || fail=1
+compare /dev/null out || fail=1 # Expect no output
+
+# Extract the bootcode for comparison
+dd if=$dev of=after bs=1 skip=1M count=$bootcode_size || fail=1
+
+# Expect bootcode has not changed
+compare before after || fail=1
+
+Exit $fail
diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh
new file mode 100644
index 0000000..b86dadc
--- /dev/null
+++ b/tests/t2310-dos-extended-2-sector-min-offset.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+# Ensure that parted allows a single sector between the beginning
+# of an extended partition and the first logical partition.
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+# create memory-backed device
+ss=$sector_size_
+scsi_debug_setup_ sector_size=$ss dev_size_mb=1 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+p1=${scsi_dev}1
+p5=${scsi_dev}5
+
+cat <<EOF > exp || framework_failure
+BYT;
+$scsi_dev:$((2048*512/$ss))s:scsi:$ss:$ss:msdos:Linux scsi_debug:;
+1:64s:128s:65s:::lba;
+5:65s:128s:64s:::;
+EOF
+
+# Create a DOS label with an extended partition starting at sector 64.
+parted -s $scsi_dev mklabel msdos || fail=1
+parted --align=min -s $scsi_dev mkpart extended 64s 128s> out 2>&1 || fail=1
+parted -m -s $scsi_dev u s print
+compare /dev/null out || fail=1
+
+# Trying to create a partition that starts just
+# one sector after the start of the extended partition.
+parted --align=min -s $scsi_dev mkpart logical 65s 128s > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+parted -m -s $scsi_dev u s print > out 2>&1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t2320-dos-extended-noclobber.sh b/tests/t2320-dos-extended-noclobber.sh
new file mode 100644
index 0000000..ac84cd5
--- /dev/null
+++ b/tests/t2320-dos-extended-noclobber.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Ensure that the extended partition reports the correct length
+# after adding another partition.
+
+# Copyright (C) 2015, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+# create memory-backed device
+ss=$sector_size_
+scsi_debug_setup_ sector_size=$ss dev_size_mb=10 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+# Create a DOS label with an extended partition and a primary partition
+parted -s $scsi_dev mklabel msdos || fail=1
+parted -s $scsi_dev mkpart extended 1 5 > out 2>&1 || fail=1
+parted -s $scsi_dev mkpart primary 5 10 > out 2>&1 || fail=1
+wait_for_dev_to_appear_ ${scsi_dev}1 || fail=1
+
+# Make sure the size of the extended partition is correct.
+# 2 sectors for 512b and 1 sector for larger. /sys/.../size is in
+# 512b blocks so convert accordingly.
+dev=${scsi_dev#/dev/}
+ext_len=$(cat /sys/block/$dev/${dev}1/size)
+if [ $ss -eq 512 ]; then
+ expected_len=2
+else
+ expected_len=$((ss / 512))
+fi
+[ $ext_len -eq $expected_len ] || fail=1
+
+Exit $fail
diff --git a/tests/t2400-dos-hfs-partition-type.sh b/tests/t2400-dos-hfs-partition-type.sh
new file mode 100644
index 0000000..6b0a9a4
--- /dev/null
+++ b/tests/t2400-dos-hfs-partition-type.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Ensure that an HFS partition in a dos table gets the right ID
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+ss=$sector_size_
+n_sectors=8000
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || framework_failure
+
+# create a MS-DOS partition table
+parted -s $dev mklabel msdos \
+ mkpart pri hfs 2048s 4095s \
+ mkpart pri hfs+ 4096s 6143s > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Extract the "type" byte of the first partition.
+od -An -j450 -tx1 -N1 $dev > out || fail=1
+od -An -j466 -tx1 -N1 $dev >> out || fail=1
+printf ' af\n af\n' > exp || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t2410-dos-udf-partition-type.sh b/tests/t2410-dos-udf-partition-type.sh
new file mode 100644
index 0000000..fa10d72
--- /dev/null
+++ b/tests/t2410-dos-udf-partition-type.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Ensure that an UDF partition in a dos table gets the right ID
+
+# Copyright (C) 2018-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+ss=$sector_size_
+n_sectors=8000
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel msdos \
+ mkpart pri udf 2048s 4095s > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Extract the "type" byte of the first partition.
+od -An -j450 -tx1 -N1 $dev > out || fail=1
+printf ' 07\n' > exp || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t2500-probe-corrupt-hfs.sh b/tests/t2500-probe-corrupt-hfs.sh
new file mode 100755
index 0000000..5d64d90
--- /dev/null
+++ b/tests/t2500-probe-corrupt-hfs.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Do not misbehave when probing a corrupt HFS partition.
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+N=3M
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+parted -s "$dev" mklabel gpt mkpart p1 1MiB 2MiB > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+parted -s "$dev" u s p || fail=1
+
+# Poke an HFS+ signature into place
+printf '\x48\x2b' | dd of=$dev seek=$((2048+2)) conv=notrunc || fail=1
+
+# Or, if starting from a valid HFS/HFS+ file system, poke these:
+# offset 18 total_blocks=0(16b)
+# offset 20 vh->block_size=0(32b)
+
+parted -s "$dev" u s p || fail=1
+
+Exit $fail
diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
new file mode 100755
index 0000000..5939eeb
--- /dev/null
+++ b/tests/t3000-resize-fs.sh
@@ -0,0 +1,156 @@
+#!/bin/sh
+# exercise the resize library; FAT and HFS+ only
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted .
+require_root_
+require_scsi_debug_module_
+require_512_byte_sector_size_
+
+
+FSTYPES=""
+
+# Is mkfs.hfsplus available?
+mkfs.hfsplus 2>&1 | grep '^usage:' && FSTYPES="hfs+"
+
+# Is mkfs.vfat available?
+mkfs.vfat 2>&1 | grep '^Usage:' && FSTYPES="$FSTYPES fat32 fat16"
+
+[ -n "$FSTYPES" ] || skip_ "Neither mkfs.hfsplus nor mkfs.vfat installed"
+
+
+ss=$sector_size_
+
+start=63s
+default_end=546147s
+ new_end=530144s
+
+# create memory-backed device. Must be > 256MB+8MB
+scsi_debug_setup_ dev_size_mb=267 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+dev=$(cat dev-name)
+
+fail=0
+
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# ensure that the disk is large enough
+dev_n_sectors=$(parted -s $dev u s p|sed -n '2s/.* \([0-9]*\)s$/\1/p')
+device_sectors_required=$(echo $default_end | sed 's/s$//')
+# Ensure that $dev is large enough for this test
+test $device_sectors_required -le $dev_n_sectors || fail=1
+
+# create mount point dir
+mount_point="`pwd`/mnt"
+mkdir "$mount_point" || fail=1
+
+# be sure to unmount upon interrupt, failure, etc.
+cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; }
+
+for fs_type in $FSTYPES; do
+ echo "fs_type=$fs_type"
+
+ # create an empty $fs_type partition, cylinder aligned, size > 256 MB
+ parted -a min -s $dev mkpart p1 $start $default_end > out 2>&1 || fail=1
+ compare /dev/null out || fail=1
+
+ # print partition table
+ parted -m -s $dev u s p > out 2>&1 || fail=1
+
+ # wait for new partition device to appear
+ wait_for_dev_to_appear_ ${dev}1
+
+ case $fs_type in
+ fat16) mkfs_cmd='mkfs.vfat -F 16'; fsck='fsck.vfat -v';;
+ fat32) mkfs_cmd='mkfs.vfat -F 32'; fsck='fsck.vfat -v';;
+ hfs*) mkfs_cmd='mkfs.hfsplus'; fsck=fsck.hfsplus;;
+ *) error "internal error: unhandled fs type: $fs_type";;
+ esac
+
+ # create the file system
+ $mkfs_cmd ${dev}1 || fail=1
+
+ # create 500 deep directory tree with longest name 4000 characters
+ # to catch core dump in libparted/fs/r/fat/count.c flag_traverse_dir()
+ # overflowing 512 byte file_name local buffer.
+ mount "${dev}1" "$mount_point" || fail=1
+ cat /dev/null > exp
+ ( cd "$mount_point"; for d in `seq 500`; do mkdir TESTDIR; cd TESTDIR; done ) > out
+ compare exp out || fail=1 # Ensure no errors creating directory tree
+ umount "${dev}1" || fail=1
+
+ # NOTE: shrinking is the only type of resizing that works.
+ # resize that file system to be one cylinder (8MiB) smaller
+ fs-resize ${dev}1 0 $new_end > out 2>&1 || fail=1
+
+ # check for expected output
+ case $fs_type in
+ fat16) cat << EOF > exp || framework_failure
+Information: Would you like to use FAT32? If you leave your file system as FAT16, then you will have no problems. If you convert to FAT32, and MS Windows is installed on this partition, then you must re-install the MS Windows boot loader. If you want to do this, you should consult the Parted manual (or your distribution's manual). Also, converting to FAT32 will make the file system unreadable by MS DOS, MS Windows 95a, and MS Windows NT.
+EOF
+ ;;
+ fat32) cat /dev/null > exp || framework_failure;; # expect no output
+ hfs*) cat /dev/null > exp || framework_failure;; # expect no output
+ esac
+ compare exp out || fail=1
+
+ # This is known to segfault with fsck.hfs from
+ # Fedora 16's hfsplus-tools-332.14-12.fc15.x86_64.
+ # You can build a working version from
+ # git://cavan.codon.org.uk/hfsplus-tools.git
+
+ # Skip the fsck.hfs test unless it understands the -v option.
+ skip=0
+ case $fs_type in
+ hfs*) $fsck -v || { warn_ skipping $fsck test; skip=1; } ;; esac
+
+ if test $skip = 0; then
+ $fsck ${dev}1 > out || fail=1
+ cat out
+ # Oops. Currently, fsck.hfs reports this:
+ # Executing fsck_hfs (version 540.1-Linux).
+ # ** Checking non-journaled HFS Plus Volume.
+ # The volume name is untitled
+ # ** Checking extents overflow file.
+ # ** Checking catalog file.
+ # ** Checking multi-linked files.
+ # ** Checking catalog hierarchy.
+ # ** Checking volume bitmap.
+ # Volume bitmap needs minor repair for orphaned blocks
+ # ** Checking volume information.
+ # Invalid volume free block count
+ # (It should be 67189 instead of 65197)
+ # Volume header needs minor repair
+ # (2, 0)
+ # FIXME: This means the HFS resizing code is wrong.
+
+ # FIXME: parse "out" for FS size and verify that it's the new, smaller size
+ fi
+
+ # Remove the partition explicitly, so that mklabel doesn't evoke a warning.
+ parted -s $dev rm 1 || fail=1
+
+ # Create a clean partition table for the next iteration.
+ parted -s $dev mklabel gpt > out 2>&1 || fail=1
+ # expect no output
+ compare /dev/null out || fail=1
+
+done
+
+Exit $fail
diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh
new file mode 100755
index 0000000..846fbc3
--- /dev/null
+++ b/tests/t3200-resize-partition.sh
@@ -0,0 +1,127 @@
+#!/bin/sh
+# exercise the resize sub-command
+# based on t3000-resize-fs.sh test
+
+# Copyright (C) 2009-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+ss=$sector_size_
+
+default_start=1024s
+default_end=2048s
+
+# create memory-backed device
+scsi_debug_setup_ dev_size_mb=5 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+dev=$(cat dev-name)
+
+# TODO test simple shrink
+# TODO test expand past end of the disk
+# TODO test expand past begin of next partition
+# TODO test shrink before start
+# TODO test everything with GPT
+# TODO more tests with extended/logical partitions
+
+parted -s $dev mklabel msdos > out 2> err || fail=1
+# expect no output
+compare /dev/null out || fail=1
+compare /dev/null err || fail=1
+
+# ensure that the disk is large enough
+dev_n_sectors=$(parted -s $dev u s p|sed -n '2s/.* \([0-9]*\)s$/\1/p')
+device_sectors_required=$(echo $default_end | sed 's/s$//')
+# Ensure that $dev is large enough for this test
+test $device_sectors_required -le $dev_n_sectors || fail=1
+
+# create an empty partition
+parted -a minimal -s $dev mkpart primary $default_start $default_end > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# print partition table
+parted -m -s $dev u s p > out 2>&1 || fail=1
+
+# FIXME: check expected output
+
+# wait for new partition device to appear
+wait_for_dev_to_appear_ ${dev}1 || { warn_ "${dev}1 did not appear" fail=1; }
+sleep 1
+
+# Running it without end should not core-dump or prompt
+parted -s $dev resizepart 1 > out 2> err || fail=1
+
+# extend the filesystem to end on sector 2048
+new_end=2048s
+parted -s $dev resizepart 1 $new_end > out 2> err || fail=1
+# expect no output
+compare /dev/null out || fail=1
+compare /dev/null err || fail=1
+
+# print partition table
+parted -m -s $dev u s p > out 2>&1 || fail=1
+
+sed -n 3p out > k && mv k out || fail=1
+printf "1:$default_start:$new_end:1025s:::$ms;\n" > exp || fail=1
+compare exp out || fail=1
+
+## Make sure resizing a busy partition works when user answers 'yes'
+# Format the partition and mount it for the busy check
+mkfs.ext4 "${dev}1" || skip_ mkfs.ext4 failed
+
+# be sure to unmount upon interrupt, failure, etc.
+cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; }
+
+mount_point=$(pwd)/mnt
+
+mkdir $mount_point || fail=1
+mount "${dev}1" "$mount_point" || fail=1
+
+# extend the filesystem to end on sector 4096
+new_end=4096s
+echo yes | parted ---pretend-input-tty $dev resizepart 1 $new_end > out 2>&1
+cat > exp <<EOF
+Warning: Partition ${dev}1 is being used. Are you sure you want to continue?
+Yes/No? yes
+Information: You may need to update /etc/fstab.
+
+EOF
+# Transform the actual output, to avoid spurious differences when
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s, * ,,g;s, $,," o2 > out
+compare exp out || fail=1
+
+# print partition table
+parted -m -s $dev u s p > out 2>&1 || fail=1
+
+sed -n 3p out > k && mv k out || fail=1
+printf "1:$default_start:$new_end:3073s:ext2::$ms;\n" > exp || fail=1
+compare exp out || fail=1
+
+umount "${dev}1" || fail=1
+
+# Remove the partition explicitly, so that mklabel doesn't evoke a warning.
+parted -s $dev rm 1 || fail=1
+
+# Create a clean partition table for the next iteration.
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+Exit $fail
diff --git a/tests/t3200-type-change.sh b/tests/t3200-type-change.sh
new file mode 100755
index 0000000..a57ad70
--- /dev/null
+++ b/tests/t3200-type-change.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+# Ensure parted doesn't change the type of a partition to match its FS.
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_ 'this system lacks a new-enough libblkid'
+
+# create memory-backed device
+scsi_debug_setup_ dev_size_mb=10 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+# Create an empty partition of "type fat32", and then create an actual
+# ext2 partition in it. Then "unset" the already unset LVM flag on that
+# partition and ensure that parted doesn't "helpfully" change the partition
+# type to match the newly-detected FS type.
+
+parted -s $scsi_dev mklabel msdos mkpart primary fat32 1MiB 100% || fail=1
+
+parted -s $scsi_dev u s p
+
+p1=${scsi_dev}1
+wait_for_dev_to_appear_ $p1 || fail=1
+mkfs.ext2 $p1 || fail=1
+
+# print as hex, the type of the first partition
+msdos_p1_type() { od -An --skip=450 -N1 -tx1 "$1"; }
+
+# Initially, it is 0x0c (FAT32).
+type=$(msdos_p1_type $scsi_dev) || fail=1
+type=${type# } # remove leading space
+case $type in
+ 0c) ;;
+ *) fail_ "expected initial type of 0c (FAT32)";;
+esac
+
+parted -s $scsi_dev u s p
+parted -s $scsi_dev set 1 lvm off || fail=1
+
+# Before parted-2.1, the above would mistakenly change it to 0x83,
+# to match the file system now residing in that partition.
+type=$(msdos_p1_type $scsi_dev) || fail=1
+type=${type# } # remove leading space
+case $type in
+ 0c) ;;
+ *) fail_ "parted changed the type of partition 1 from 0c to $type";;
+esac
+
+# Ensure that setting the "lvm" flag still works.
+parted -s $scsi_dev set 1 lvm on || fail=1
+parted -s $scsi_dev u s p > out || fail=1
+grep lvm out || { fail=1; cat out; }
+
+Exit $fail
diff --git a/tests/t3210-gpt-type-change.sh b/tests/t3210-gpt-type-change.sh
new file mode 100755
index 0000000..46d6cc2
--- /dev/null
+++ b/tests/t3210-gpt-type-change.sh
@@ -0,0 +1,107 @@
+#!/bin/sh
+# Ensure parted changes GUID back to match its FS.
+
+# Copyright (C) 2021-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_ 'this system lacks a new-enough libblkid'
+
+# What filesystem tools are present?
+FSTYPES=""
+
+# Is mkfs.hfsplus available?
+mkfs.hfsplus 2>&1 | grep '^usage:' && FSTYPES="hfs+"
+
+# Is mkfs.vfat available?
+mkfs.vfat 2>&1 | grep '^Usage:' && FSTYPES="$FSTYPES fat32"
+
+# Is mkswap available?
+mkswap -V 2>&1 | grep '^mkswap' && FSTYPES="$FSTYPES linux-swap"
+
+[ -n "$FSTYPES" ] || skip_ "No supported filesystem tools (vfat, hfs+, swap) installed"
+
+
+# create memory-backed device
+scsi_debug_setup_ dev_size_mb=25 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+# Create a formatted partition.
+# Set a different partition type on it, eg. lvm, then unset it.
+# The partition flag should return to the detected filesystem type.
+
+for fs_type in $FSTYPES; do
+ echo "fs_type=$fs_type"
+
+
+ parted -s $scsi_dev mklabel gpt mkpart first $fs_type 1MB 25MB > out 2>&1 || fail=1
+ # expect no output
+ compare /dev/null out || fail=1
+
+ p1=${scsi_dev}1
+ wait_for_dev_to_appear_ $p1 || fail=1
+
+ case $fs_type in
+ fat32) mkfs.vfat $p1 || fail=1 ;;
+ hfs*) mkfs.hfsplus $p1 || fail=1;;
+ linux-swap) mkswap $p1 || fail=1;;
+ *) error "internal error: unhandled fs type: $fs_type";;
+ esac
+
+ # Confirm the filesystem and flags are as expected
+ parted -s $scsi_dev u s p > out || fail=1
+ case $fs_type in
+ fat32) grep 'fat16.*msftdata$' out || { fail=1; cat out; } ;;
+ hfs*) grep 'hfs+.*first$' out || { fail=1; cat out; } ;;
+ linux-swap) grep 'linux-swap.*swap$' out || { fail=1; cat out; } ;;
+ *) error "internal error: unhandled fs type: $fs_type";;
+ esac
+
+ # Set the lvm GUID on the partition
+ parted -s $scsi_dev set 1 lvm on > out 2>&1 || fail=1
+ # expect no output
+ compare /dev/null out || fail=1
+
+ # Confirm filesystem probe is the same, but flags are now lvm
+ parted -s $scsi_dev u s p > out || fail=1
+ case $fs_type in
+ fat32) grep 'fat16.*lvm$' out || { fail=1; cat out; } ;;
+ hfs*) grep 'hfs+.*lvm$' out || { fail=1; cat out; } ;;
+ linux-swap) grep 'linux-swap.*lvm$' out || { fail=1; cat out; } ;;
+ *) error "internal error: unhandled fs type: $fs_type";;
+ esac
+
+ # Unset the lvm GUID on both partitions
+ parted -s $scsi_dev set 1 lvm off > out 2>&1 || fail=1
+ # expect no output
+ compare /dev/null out || fail=1
+
+ # Confirm the filesystem and flags are as expected
+ parted -s $scsi_dev u s p > out || fail=1
+ case $fs_type in
+ fat32) grep 'fat16.*msftdata$' out || { fail=1; cat out; } ;;
+ hfs*) grep 'hfs+.*first$' out || { fail=1; cat out; } ;;
+ linux-swap) grep 'linux-swap.*swap$' out || { fail=1; cat out; } ;;
+ *) error "internal error: unhandled fs type: $fs_type";;
+ esac
+done
+
+Exit $fail
diff --git a/tests/t3300-palo-prep.sh b/tests/t3300-palo-prep.sh
new file mode 100755
index 0000000..fc9e8f6
--- /dev/null
+++ b/tests/t3300-palo-prep.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Ensure that palo and prep types work properly.
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+cat > exp <<EOF || framework_failure
+1:2048s:4095s:2048s:ext2::palo;
+1:2048s:4095s:2048s:ext2::prep;
+1:2048s:4095s:2048s:ext2::palo;
+EOF
+
+dev=dev-file
+
+n_sectors=5000
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+parted -m -s $dev mklabel msdos \
+ mkpart pri ext2 $((1*2048))s $((2*2048-1))s \
+ set 1 palo on u s print \
+ set 1 prep on u s print \
+ set 1 palo on u s print \
+ > out 2> err || fail=1
+
+grep -E '^1:2048s:4095s:2048s:ext2::p...;$' out > k; mv k out
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
new file mode 100644
index 0000000..8614c32
--- /dev/null
+++ b/tests/t3310-flags.sh
@@ -0,0 +1,134 @@
+#!/bin/sh
+# Exercise partition flags.
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted .
+ss=$sector_size_
+dev=dev-file
+
+extract_flags()
+{
+ perl -nle '/^[^:]*:4096s:6143s:2048s::[^:]*:(.+);$/ and print $1' "$@"
+}
+
+for table_type in aix amiga atari bsd dvh gpt mac msdos pc98 sun loop; do
+ ptn_num=1
+
+ case $table_type in
+ aix) # Support for writing AIX disk labels and adding partitions
+ # is not yet implemented.
+ continue
+ ;;
+ amiga) primary_or_name='PTNNAME'
+ ;;
+ atari) primary_or_name='primary'
+ # atari only supports 512b sectors
+ [ $ss -ne 512 ] && continue
+ ;;
+ bsd) primary_or_name=''
+ ;;
+ dvh) primary_or_name='primary'
+ ;;
+ gpt) primary_or_name='PTNNAME'
+ ;;
+ mac) primary_or_name='PTNNAME'
+ # MAC table has the partition map partition as the first
+ # partition so the created test partition will be number 2.
+ ptn_num=2
+ ;;
+ msdos) primary_or_name='primary'
+ ;;
+ pc98) primary_or_name='PTNNAME'
+ # pc98 only supports 512b sectors
+ [ $ss -ne 512 ] && continue
+ ;;
+ sun) primary_or_name=''
+ ;;
+ loop) # LOOP table doesn't support creation of a partition nor any
+ # flags.
+ continue
+ ;;
+ esac
+
+ n_sectors=8192
+ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+ parted -s $dev mklabel $table_type \
+ mkpart $primary_or_name ext2 $((4*1024))s $((6*1024-1))s \
+ > out 2> err || fail=1
+ compare /dev/null out || fail=1
+
+ # Query libparted for the available flags for this test partition.
+ flags=`print-flags $dev $ptn_num` \
+ || { warn_ "$ME_: $table_type: failed to get available flags";
+ fail=1; continue; }
+ case $table_type in
+ dvh) # FIXME: Exclude boot flag as that can only be set on logical
+ # partitions in the DVH disk label and this test only uses
+ # primary partitions.
+ flags=`echo "$flags" | egrep -v 'boot'`
+ ;;
+ mac) # FIXME: Setting root or swap flags also sets the partition
+ # name to root or swap respectively. Probably intended
+ # behaviour. Setting lvm or raid flags after root or swap
+ # takes two goes to clear the lvm or raid flag. Is this
+ # intended? For now don't test lvm or raid flags as this
+ # test only tries to clear the flags once which causes this
+ # test to fail.
+ flags=`echo "$flags" | egrep -v 'lvm|raid'`
+ ;;
+ msdos) # FIXME: Exclude flags that can only be set in combination
+ # with certain other flags.
+ flags=`echo "$flags" | egrep -v 'hidden|lba'`
+ ;;
+ esac
+
+ for mode in on_only on_and_off ; do
+ for flag in $flags; do
+ # Turn on each flag, one at a time.
+ parted -m -s $dev set $ptn_num $flag on unit s print > raw 2> err || fail=1
+ extract_flags raw > out
+ grep -w "$flag" out \
+ || { warn_ "$ME_: $table_type: flag '$flag' not turned on: $(cat out)"; fail=1; }
+ compare /dev/null err || fail=1
+
+ if test $mode = on_and_off; then
+ # Turn it off
+ parted -m -s $dev set $ptn_num $flag off unit s print > raw 2> err || fail=1
+ extract_flags raw > out
+ grep -w "$flag" out \
+ && { warn_ "$ME_: $table_type: flag '$flag' not turned off: $(cat out)"; fail=1; }
+ compare /dev/null err || fail=1
+ fi
+ done
+ done
+done
+
+# loop filesystems support no flags. Make sure this doesn't crash
+
+if [ $ss = 512 ]; then
+ # only test on 512 byte ss since mke2fs assumes this on a file
+ truncate -s 5m img || framework_failure
+ mke2fs img || framework_failure
+ echo Error: No flags supported > out.exp
+ parted -s img set 1 foo on > out 2>&1
+ compare out.exp out || fail=1
+ parted -s img disk_set foo on > out 2>&1
+ compare out.exp out || fail=1
+fi
+
+Exit $fail
diff --git a/tests/t3400-whole-disk-FAT-partition.sh b/tests/t3400-whole-disk-FAT-partition.sh
new file mode 100755
index 0000000..e65894a
--- /dev/null
+++ b/tests/t3400-whole-disk-FAT-partition.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Ensure that a whole-disk FAT partition is detected.
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev_file=dev-file
+
+echo '1:0s:81919s:81920s:fat16::;' > exp || framework_failure_
+dd if=/dev/null of=$dev_file bs=1 seek=40M || framework_failure_
+mkfs.vfat -F 16 $dev_file || skip_ "mkfs.vfat failed"
+
+parted -m -s $dev_file u s print > out 2>&1 || fail=1
+grep '^1:' out > k; mv k out
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t4000-sun-raid-type.sh b/tests/t4000-sun-raid-type.sh
new file mode 100755
index 0000000..94e0edd
--- /dev/null
+++ b/tests/t4000-sun-raid-type.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+# RAID support on sun disk type
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+# Written by Tom "spot" Callaway <tcallawa@redhat.com>
+# Derived from an example by Jim Meyering <jim@meyering.net>
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+N=2000 # number of sectors
+dev=sun-disk-file
+exp="BYT;\n---:${N}s:file:$ss:$ss:sun::;\n1:0s:127s:128s"
+# create an empty file as a test disk
+dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null || fail=1
+
+# label the test disk as a sun disk
+parted -s $dev mklabel sun > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# create a single partition
+parted -s $dev unit s mkpart ext2 0s 127s > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# print the partition data in machine readable format
+parted -m -s $dev unit s p > out 2>&1 || fail=1
+sed "s,^.*/$dev:,---:," out > k && mv k out
+
+# check for expected values for the partition
+printf "$exp:::;\n" > exp || fail=1
+compare exp out || fail=1
+
+# set the raid flag
+parted -s $dev set 1 raid >out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# print the partition data in machine readable format again
+parted -m -s $dev unit s p > out 2>&1 || fail=1
+sed "s,^.*/$dev:,---:," out > k && mv k out || fail=1
+
+# check for expected values (including raid flag) for the partition
+printf "$exp:::raid;\n" > exp || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t4001-sun-vtoc.sh b/tests/t4001-sun-vtoc.sh
new file mode 100755
index 0000000..acd8099
--- /dev/null
+++ b/tests/t4001-sun-vtoc.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Ensure that Sun VTOC is properly initialized.
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+# Written by Karel Zak <kzak@redhat.com>
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+N=2M
+dev=loop-file
+# create a file to simulate the underlying device
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+# label the test disk
+parted -s $dev mklabel sun > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# extract version
+od -t x1 -An -j128 -N4 $dev > out || fail=1
+echo " 00 00 00 01" > exp || fail=1
+# expect it to be 00 00 00 01, not 00 00 00 00
+compare exp out || fail=1
+
+# extract nparts
+od -t x1 -An -j140 -N2 $dev > out || fail=1
+echo " 00 08" > exp || fail=1
+
+# expect it to be 00 08, not 00 00
+compare exp out || fail=1
+
+# extract sanity magic
+od -t x1 -An -j188 -N4 $dev > out || fail=1
+echo " 60 0d de ee" > exp
+# expect it to be 60 0d de ee, not 00 00 00 00
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh
new file mode 100755
index 0000000..fec7576
--- /dev/null
+++ b/tests/t4100-dvh-partition-limits.sh
@@ -0,0 +1,166 @@
+#!/bin/sh
+# enforce limits on partition start sector and length
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_root_
+require_xfs_
+ss=$sector_size_
+
+# On a 32-bit system, we must skip this test when $ss >= 4096.
+# Otherwise, due to an inherent 32-bit-XFS limit, dd would fail to
+# create the file of size > 16TiB
+if test $(uname -m) != x86_64; then
+ test $ss -le 2048 || skip_ 'this test works only on a 64-bit system'
+fi
+
+####################################################
+# Create and mount a file system capable of dealing with >=2TB files.
+# We must be able to create a file with an apparent length of 2TB or larger.
+# It needn't be a large file system.
+fs=fs_file
+mp=`pwd`/mount-point
+n=4096
+
+# create an XFS file system
+mkfs.xfs -dfile,name=$fs,size=300m || fail=1
+mkdir "$mp" || fail=1
+
+# Unmount upon interrupt, failure, etc., as well as upon normal completion.
+cleanup_fn_() { cd "$test_dir_" && umount "$mp" > /dev/null 2>&1; }
+
+# mount it
+mount -o loop $fs "$mp" || fail=1
+cd "$mp" || fail=1
+
+dev=loop-file
+
+do_mkpart()
+{
+ set +x # Turn off tracing; otherwise, we pollute stderr.
+ start_sector=$1
+ end_sector=$2
+ # echo '********' $(echo $end_sector - $start_sector + 1 |bc)
+ dd if=/dev/zero of=$dev bs=$ss count=2k seek=$end_sector 2> /dev/null &&
+ parted -s $dev mklabel $table_type &&
+ parted -s $dev mkpart p xfs ${start_sector}s ${end_sector}s
+}
+
+# Specify the starting sector number and length in sectors,
+# rather than start and end.
+do_mkpart_start_and_len()
+{
+ set +x # Turn off tracing; otherwise, we pollute stderr.
+ start_sector=$1
+ len=$2
+ end_sector=$(echo $start_sector + $len - 1|bc)
+ do_mkpart $start_sector $end_sector
+}
+
+for table_type in dvh; do
+
+# a partition length of 2^32-1 works.
+end=$(echo $n+2^32-2|bc) || fail=1
+do_mkpart $n $end || fail=1
+
+# print the result
+parted -s $dev unit s p > out 2>&1 || fail=1
+sed -n "/^ *1 *$n/s/ */ /gp" out|sed "s/ *\$//" > k && mv k out || fail=1
+echo " 1 ${n}s ${end}s 4294967295s primary" > exp || fail=1
+compare exp out || fail=1
+
+# a partition length of exactly 2^32 sectors provokes failure.
+do_mkpart $n $(echo $n+2^32-1|bc) > err 2>&1
+test $? = 1 || fail=1
+
+bad_part_length()
+{ echo "Error: partition length of $1 sectors exceeds the"\
+ "$table_type-partition-table-imposed maximum of 4294967295"; }
+
+# check for new diagnostic
+bad_part_length 4294967296 > exp || fail=1
+compare exp err || fail=1
+
+# FIXME: investigate this.
+# Unexpectedly to me, both of these failed with this same diagnostic:
+#
+# Error: partition length of 4294967296 sectors exceeds the \
+# DOS-partition-table-imposed maximum of 2^32-1" > exp &&
+#
+# I expected the one below to fail with a length of _4294967297_.
+# Debugging, I see that _check_partition *does* detect this,
+# but the diagnostic doesn't get displayed because of the wonders
+# of parted's exception mechanism.
+
+# a partition length of 2^32+1 sectors must provoke failure.
+do_mkpart $n $(echo $n+2^32|bc) > err 2>&1
+test $? = 1 || fail=1
+
+# check for new diagnostic
+bad_part_length 4294967297 > exp || fail=1
+compare exp err || fail=1
+
+# =========================================================
+# Now consider partition starting sector numbers.
+bad_start_sector()
+{ echo "Error: starting sector number, $1 exceeds the"\
+ "$table_type-partition-table-imposed maximum of 4294967295"; }
+
+# a partition start sector number of 2^32-1 works.
+do_mkpart_start_and_len $(echo 2^32-1|bc) 1000 || fail=1
+
+# FIXME: this partition number 9 (not requested!) looks totally bogus
+# FIXME: For now, we just expect what the code produces.
+# FIXME: In the long run, figure out if it's sensible.
+cat > exp <<EOF
+Model: (file)
+Disk $dev: 4294970342s
+Sector size (logical/physical): ${ss}B/${ss}B
+Partition Table: $table_type
+Disk Flags:
+
+Number Start End Size Type File system Name Flags
+ 9 0s 4095s 4096s extended
+ 1 4294967295s 4294968294s 1000s primary
+
+EOF
+
+# print the result
+parted -s $dev unit s p > out 2>&1 || fail=1
+sed "s/^Disk .*\($dev: [0-9][0-9]*s\)$/Disk \1/;s/ *$//" out > k \
+ && mv k out || fail=1
+compare exp out || fail=1
+
+# a partition start sector number of 2^32 must fail
+do_mkpart_start_and_len $(echo 2^32|bc) 1000 > err 2>&1
+test $? = 1 || fail=1
+
+# check for new diagnostic
+bad_start_sector 4294967296 > exp || fail=1
+compare exp err || fail=1
+
+# a partition start sector number of 2^32+1 must fail, too.
+do_mkpart_start_and_len $(echo 2^32+1|bc) 1000 > err 2>&1
+test $? = 1 || fail=1
+
+# check for new diagnostic
+bad_start_sector 4294967297 > exp || fail=1
+compare exp err || fail=1
+
+done
+
+Exit $fail
diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh
new file mode 100755
index 0000000..2bebfb9
--- /dev/null
+++ b/tests/t4100-msdos-partition-limits.sh
@@ -0,0 +1,152 @@
+#!/bin/sh
+# enforce limits on partition start sector and length
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_root_
+require_xfs_
+ss=$sector_size_
+
+# On a 32-bit system, we must skip this test when $ss >= 4096.
+# Otherwise, due to an inherent 32-bit-XFS limit, dd would fail to
+# create the file of size > 16TiB
+if test $(uname -m) != x86_64; then
+ test $ss -le 2048 || skip_ 'this test works only on a 64-bit system'
+fi
+
+####################################################
+# Create and mount a file system capable of dealing with >=2TB files.
+# We must be able to create a file with an apparent length of 2TB or larger.
+# It needn't be a large file system.
+fs=fs_file
+mp=`pwd`/mount-point
+n=4096
+
+# create an XFS file system
+mkfs.xfs -dfile,name=$fs,size=300m || fail=1
+mkdir "$mp" || fail=1
+
+# Unmount upon interrupt, failure, etc., as well as upon normal completion.
+cleanup_fn_() { cd "$test_dir_" && umount "$mp" > /dev/null 2>&1; }
+
+# mount it
+mount -o loop $fs "$mp" || fail=1
+cd "$mp" || fail=1
+
+dev=loop-file
+
+do_mkpart()
+{
+ set +x # Turn off tracing; otherwise, we pollute stderr.
+ start_sector=$1
+ end_sector=$2
+ # echo '********' $(echo $end_sector - $start_sector + 1 |bc)
+ dd if=/dev/zero of=$dev bs=$ss count=2k seek=$end_sector 2> dd-err ||
+ { cat dd-err 1>&2; return 1; }
+ parted -s $dev mklabel $table_type &&
+ parted -s $dev mkpart p xfs ${start_sector}s ${end_sector}s
+}
+
+# Specify the starting sector number and length in sectors,
+# rather than start and end.
+do_mkpart_start_and_len()
+{
+ set +x # Turn off tracing; otherwise, we pollute stderr.
+ start_sector=$1
+ len=$2
+ end_sector=$(echo $start_sector + $len - 1|bc)
+ do_mkpart $start_sector $end_sector
+}
+
+for table_type in msdos; do
+
+# a partition length of 2^32-1 works.
+end=$(echo $n+2^32-2|bc) || fail=1
+do_mkpart $n $end || fail=1
+
+# print the result
+parted -s $dev unit s p > out 2>&1 || fail=1
+sed -n "/^ *1 *$n/s/ */ /gp" out|sed "s/ *\$//" > k && mv k out || fail=1
+echo " 1 ${n}s ${end}s 4294967295s primary" > exp || fail=1
+compare exp out || fail=1
+
+# a partition length of exactly 2^32 sectors provokes failure.
+do_mkpart $n $(echo $n+2^32-1|bc) > err 2>&1
+test $? = 1 || fail=1
+
+bad_part_length()
+{ echo "Error: partition length of $1 sectors exceeds the"\
+ "$table_type-partition-table-imposed maximum of 4294967295"; }
+
+# check for new diagnostic
+bad_part_length 4294967296 > exp || fail=1
+compare exp err || fail=1
+
+# a partition length of 2^32+1 sectors must provoke failure.
+do_mkpart $n $(echo $n+2^32|bc) > err 2>&1
+test $? = 1 || fail=1
+
+# check for new diagnostic
+bad_part_length 4294967297 > exp || fail=1
+compare exp err || fail=1
+
+# =========================================================
+# Now consider partition starting sector numbers.
+bad_start_sector()
+{ echo "Error: starting sector number, $1 exceeds the"\
+ "$table_type-partition-table-imposed maximum of 4294967295"; }
+
+# a partition start sector number of 2^32-1 works.
+do_mkpart_start_and_len $(echo 2^32-1|bc) 1000 || fail=1
+
+cat > exp <<EOF
+Model: (file)
+Disk $dev: 4294970342s
+Sector size (logical/physical): ${ss}B/${ss}B
+Partition Table: $table_type
+Disk Flags:
+
+Number Start End Size Type File system Flags
+ 1 4294967295s 4294968294s 1000s primary
+
+EOF
+
+# print the result
+parted -s $dev unit s p > out 2>&1 || fail=1
+sed "s/^Disk .*\($dev: [0-9][0-9]*s\)$/Disk \1/;s/ *$//" out > k \
+ && mv k out || fail=1
+compare exp out || fail=1
+
+# a partition start sector number of 2^32 must fail
+do_mkpart_start_and_len $(echo 2^32|bc) 1000 > err 2>&1
+test $? = 1 || fail=1
+
+# check for new diagnostic
+bad_start_sector 4294967296 > exp || fail=1
+compare exp err || fail=1
+
+# a partition start sector number of 2^32+1 must fail, too.
+do_mkpart_start_and_len $(echo 2^32+1|bc) 1000 > err 2>&1
+test $? = 1 || fail=1
+
+# check for new diagnostic
+bad_start_sector 4294967297 > exp || fail=1
+compare exp err || fail=1
+
+done
+
+Exit $fail
diff --git a/tests/t4100-msdos-starting-sector.sh b/tests/t4100-msdos-starting-sector.sh
new file mode 100755
index 0000000..e933060
--- /dev/null
+++ b/tests/t4100-msdos-starting-sector.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Consistency in msdos free space starting sector.
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+######################################################################
+# parted 1.8.8.1 and earlier was inconsistent when calculating the
+# start sector for free space in msdos type lables. parted was not
+# consistent in the use of metadata padding for msdos labels.
+######################################################################
+
+N=4096 # number of sectors
+dev=loop-file
+# create a file to simulate the underlying device
+dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null || fail=1
+
+# label the test disk
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Test the output of print free with no partitions.
+cat <<EOF > exp || fail=1
+BYT;
+path:${N}s:file:$ss:$ss:msdos::;
+1:32s:4095s:4064s:free;
+EOF
+
+# create expected output file' 'test $fail = 0'
+
+# display output of label without partitions
+parted -m -s $dev unit s print free > out 2>&1 || fail=1
+
+# check for expected output
+sed "2s/^[^:]*:/path:/" < out > k; mv k out
+compare exp out || fail=1
+
+# Test the output of print free with one partition.
+cat <<EOF > exp || fail=1
+BYT;
+path:${N}s:file:$ss:$ss:msdos::;
+1:32s:2047s:2016s:free;
+1:2048s:4095s:2048s:::;
+EOF
+
+# create a partition at the end of the label
+parted -s $dev mkpart primary 2048s 4095s || fail=1
+
+# display output of label with partition
+parted -m -s $dev unit s print free > out 2>&1 || fail=1
+
+# check for expected output
+sed "2s/^[^:]*:/path:/" < out > k; mv k out
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t4200-partprobe.sh b/tests/t4200-partprobe.sh
new file mode 100755
index 0000000..a2731f2
--- /dev/null
+++ b/tests/t4200-partprobe.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+# partprobe must not examine more than 16 partitions
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_erasable_
+require_root_
+require_dvhtool_
+
+dev=$DEVICE_TO_ERASE
+
+# setup: create a DVH partition table on $dev"
+dd if=/dev/zero of=$dev bs=512 count=1 seek=10000 || fail=1
+parted -s $dev mklabel dvh || fail=1
+
+# setup: use dvhtool to create a 17th (invalid?) partition"
+dd if=/dev/zero of=d bs=1 count=4k || fail=1
+dvhtool -d $dev --unix-to-vh d data || fail=1
+
+# Here's sample output from the parted...print command below:
+# BYT;
+# /dev/sdd:128880s:scsi:512:512:dvh: Flash Disk:;
+# 9:0s:4095s:4096s:::;
+# 17:4s:11s:8s::data:;
+
+# ensure that dvhtool did what we want"
+parted -m -s $dev unit s print > out 2>&1 || fail=1
+grep "^17:.*::data:;\$" out || fail=1
+
+# Parted 1.8.9 and earlier would mistakenly try to access partition #17.
+# ensure that partprobe succeeds and produces no output"
+partprobe -s $dev > out 2>err || fail=1
+compare /dev/null err || fail=1
+echo "$dev: dvh partitions 9 <17>" > exp || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t4300-nilfs2-tiny.sh b/tests/t4300-nilfs2-tiny.sh
new file mode 100755
index 0000000..28ccb7e
--- /dev/null
+++ b/tests/t4300-nilfs2-tiny.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Trigger a nilfs2-related bug.
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+n_sectors=200
+dev=dev-file
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || framework_failure_
+
+# Create a tiny, 7-sector partition.
+parted -s $dev mklabel gpt mkpart p1 64s 70s || framework_failure_
+
+# This used to make parted abort.
+parted -s $dev u s p || fail=1
+
+Exit $fail
diff --git a/tests/t4301-nilfs2-badsb2.sh b/tests/t4301-nilfs2-badsb2.sh
new file mode 100755
index 0000000..2a1205b
--- /dev/null
+++ b/tests/t4301-nilfs2-badsb2.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Trigger a nilfs2-related bug.
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+len=32
+dev=dev-file
+
+dd if=/dev/zero of=$dev bs=512 count=$(($len+$ss/512)) || framework_failure_
+
+end=$(($len * 512 / $ss))
+parted -s $dev mklabel msdos mkpart primary 1s ${end}s || framework_failure_
+
+# Write a secondary superblock with the nilfs magic number and a nilfs
+# superblock length (s_bytes) field of only 10 bytes.
+# struct nilfs2_super_block starts with these four fields...
+# uint32_t s_rev_level;
+# uint16_t s_minor_rev_level;
+# uint16_t s_magic;
+# uint16_t s_bytes;
+sb2_offset=$(( 24 / ($ss / 512) + 1))
+perl -e "print pack 'LSSS.', 0, 0, 0x3434, 10, $ss" |
+ dd of=$dev bs=$ss seek=$sb2_offset count=1 conv=notrunc
+
+# This used to give parted a sigsegv.
+parted -s $dev print || fail=1
+
+Exit $fail
diff --git a/tests/t4302-nilfs2-lessbadsb2.sh b/tests/t4302-nilfs2-lessbadsb2.sh
new file mode 100755
index 0000000..1857b29
--- /dev/null
+++ b/tests/t4302-nilfs2-lessbadsb2.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# Trigger a nilfs2-related bug.
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+# This test is like t4301-nilfsbadsb2 except with an s_bytes field of
+# 1024 instead of 10. This exercises a less obvious bug.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+len=32
+dev=dev-file
+
+dd if=/dev/zero of=$dev bs=512 count=$(($len+$ss/512)) || framework_failure_
+
+end=$(($len * 512 / $ss))
+parted -s $dev mklabel msdos mkpart primary 1s ${end}s || framework_failure_
+
+# Write a secondary superblock with the nilfs magic number and a nilfs
+# superblock length (s_bytes) field of only 10 bytes.
+# struct nilfs2_super_block starts with these four fields...
+# uint32_t s_rev_level;
+# uint16_t s_minor_rev_level;
+# uint16_t s_magic;
+# uint16_t s_bytes;
+sb2_offset=$(( 24 / ($ss / 512) + 1))
+perl -e "print pack 'LSSS.', 0, 0, 0x3434, 1024, $ss" |
+ dd of=$dev bs=$ss seek=$sb2_offset count=1 conv=notrunc
+
+# This used to read past the part of the stack allocated by alloca, but
+# may or may not cause a segmentation fault as a result.
+parted -s $dev print || fail=1
+
+Exit $fail
diff --git a/tests/t5000-tags.sh b/tests/t5000-tags.sh
new file mode 100755
index 0000000..6291657
--- /dev/null
+++ b/tests/t5000-tags.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+# test bios_grub flag in gpt labels
+
+# Copyright (C) 2007-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+dev=loop-file
+N=4200 # number of sectors
+
+part_sectors=2048
+start_sector=2048
+end_sector=$(expr $start_sector + $part_sectors - 1)
+
+# setup: reasonable params
+test $end_sector -lt $N || fail=1
+
+# setup: create zeroed device
+dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null || fail=1
+
+# create gpt label
+parted -s $dev mklabel gpt > empty 2>&1 || fail=1
+
+# ensure there was no output
+compare /dev/null empty || fail=1
+
+# print the table (before adding a partition)
+parted -m -s $dev unit s print > t 2>&1 || fail=1
+sed "s,.*/$dev:,$dev:," t > out || fail=1
+
+# check for expected output
+printf "BYT;\n$dev:${N}s:file:$ss:$ss:gpt::;\n" > exp || fail=1
+compare exp out || fail=1
+
+# add a partition
+parted -s $dev u s mkpart name1 ${start_sector} ${end_sector} >out 2>&1 \
+ || fail=1
+
+# print the table before modification
+parted -m -s $dev unit s print > t 2>&1 || fail=1
+sed "s,.*/$dev:,$dev:," t >> out || fail=1
+
+# set the new bios_grub attribute
+parted -m -s $dev set 1 bios_grub on || fail=1
+
+# print the table after modification
+parted -m -s $dev unit s print > t 2>&1 || fail=1
+sed "s,.*/$dev:,$dev:," t >> out || fail=1
+
+gen_exp()
+{
+ cat <<EOF
+BYT;
+$dev:${N}s:file:$ss:$ss:gpt::;
+1:${start_sector}s:${end_sector}s:${part_sectors}s::name1:;
+BYT;
+$dev:${N}s:file:$ss:$ss:gpt::;
+1:${start_sector}s:${end_sector}s:${part_sectors}s::name1:bios_grub;
+EOF
+}
+
+# check for expected output
+gen_exp > exp || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t6000-dm.sh b/tests/t6000-dm.sh
new file mode 100755
index 0000000..980094d
--- /dev/null
+++ b/tests/t6000-dm.sh
@@ -0,0 +1,98 @@
+#!/bin/sh
+# ensure that parted can distinguish device map types: linear, multipath
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+lvm_init_root_dir_
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
+
+# Device maps names - should be random to not conflict with existing ones on
+# the system
+linear_=plinear-$$
+mpath_=mpath-$$
+
+d1= d2= d3=
+f1= f2= f3=
+cleanup_fn_() {
+ dmsetup remove $linear_
+ dmsetup remove $mpath_
+ test -n "$d1" && losetup -d "$d1"
+ test -n "$d2" && losetup -d "$d2"
+ test -n "$d3" && losetup -d "$d3"
+ rm -f "$f1" "$f2" "$f3";
+}
+
+f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
+ || skip_ "is this partition mounted with 'nodev'?"
+
+# setup: create loop devices
+f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") || fail=1
+f3=$(pwd)/3 && d3=$(loop_setup_ "$f3") || fail=1
+
+# In the output of parted's print -s command,
+# replace (possibly varying) $dev name with '...'.
+sanitize() {
+ sed 's,^Disk .*: \([0-9][0-9]*\),Disk ...: \1,;s/ *$//' "$@"
+}
+
+# This loop used to include "multipath", but lvm2 changed
+# in such a way that that no longer works with loop devices.
+# FIXME: use two scsi_debug devices instead.
+for type in linear ; do
+
+ case $type in
+ linear)
+ type_kwd=$linear_
+ dmsetup_cmd="0 1024 linear $d1 0"
+ ;;
+ *)
+ type_kwd=$mpath_
+ dmsetup_cmd="0 1024 multipath 0 0 1 1 round-robin 0 2 0 $d2 $d3"
+ ;;
+ esac
+
+ # setup: create a mapping
+ echo "$dmsetup_cmd" | dmsetup create "$type_kwd" || fail=1
+ dev="$DM_DEV_DIR/mapper/$type_kwd"
+
+ # Create msdos partition table
+ parted -s $dev mklabel msdos > out 2>&1 || fail=1
+ compare /dev/null out || fail=1
+
+ parted -s "$dev" print > out 2>&1 || fail=1
+ sanitize out > k && mv k out || fail=1
+
+ # Create expected output file.
+ cat <<EOF >> exp || fail=1
+Model: Linux device-mapper ($type) (dm)
+Disk ...: 524kB
+Sector size (logical/physical): 512B/512B
+Partition Table: msdos
+Disk Flags:
+
+Number Start End Size Type File system Flags
+
+EOF
+
+ compare exp out || fail=1
+done
+
+Exit $fail
diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh
new file mode 100644
index 0000000..be0b7ee
--- /dev/null
+++ b/tests/t6001-psep.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+# ensure that parted names partitions on dm disks correctly
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_udevadm_settle_
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
+
+# Device maps names - should be random to not conflict with existing ones on
+# the system
+linear_=plinear-$$
+linear2_=plinear-$$foo
+
+d1= d2=
+f1= f2=
+cleanup_fn_() {
+ dmsetup remove ${linear_}p1
+ dmsetup remove $linear_
+ dmsetup remove ${linear2_}1
+ dmsetup remove $linear2_
+ test -n "$d1" && losetup -d "$d1"
+ test -n "$d2" && losetup -d "$d2"
+ rm -f "$f1 $f2";
+}
+
+loop_file_1=loop-file-1-$$
+loop_file_2=loop-file-2-$$
+
+d1=$(loop_setup_ $loop_file_1) || framework_failure
+d1_size=$(blockdev --getsz $d1)
+d2=$(loop_setup_ $loop_file_2) || framework_failure
+d2_size=$(blockdev --getsz $d2)
+
+dmsetup create $linear_ --table "0 $d1_size linear $d1 0" || framework_failure
+dev="/dev/mapper/$linear_"
+
+# Create msdos partition table
+parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+#make sure device name is correct
+wait_for_dev_to_appear_ ${dev}p1 || fail=1
+
+#repeat on name not ending in a digit
+# setup: create a mapping
+dmsetup create $linear2_ --table "0 $d2_size linear $d2 0" || framework_failure
+dev="/dev/mapper/$linear2_"
+
+# Create msdos partition table
+parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+#make sure device name is correct
+wait_for_dev_to_appear_ ${dev}1 || fail=1
+
+if [ -n "$fail" ]; then
+ ls /dev/mapper
+fi
+
+Exit $fail
diff --git a/tests/t6002-dm-busy.sh b/tests/t6002-dm-busy.sh
new file mode 100644
index 0000000..27b462d
--- /dev/null
+++ b/tests/t6002-dm-busy.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+# ensure that parted can alter a partition on a dmraid disk
+# while another one is mounted
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+
+# We could make this work for arbitrary sector size, but I'm lazy.
+require_512_byte_sector_size_
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
+
+# Device maps names - should be random to not conflict with existing ones on
+# the system
+linear_=plinear-$$
+
+d1=
+f1=
+dev=
+cleanup_fn_() {
+ umount "${dev}p2" > /dev/null 2>&1
+ dmsetup remove ${linear_}p1
+ dmsetup remove ${linear_}p2
+ dmsetup remove $linear_
+ test -n "$d1" && losetup -d "$d1"
+ rm -f "$f1"
+}
+
+f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
+ || fail=1
+
+# setup: create a mapping
+n=204800
+echo "0 $n linear $d1 0" | dmsetup create $linear_ || fail=1
+dev="/dev/mapper/$linear_"
+
+# Create msdos partition table
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+parted -s $dev -a none mkpart primary fat32 1s 1000s > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+parted -s $dev -a none mkpart primary fat32 1001s 200000s > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# wait for new partition device to appear
+wait_for_dev_to_appear_ ${dev}p2 || fail_ ${dev}p2 did not appear
+
+mkfs.vfat -F 32 ${dev}p2 || fail_ mkfs.vfat failed
+
+mount_point=$(pwd)/mnt
+
+mkdir $mount_point || fail=1
+mount "${dev}p2" "$mount_point" || fail=1
+
+# Removal of unmounted partition must succeed.
+parted -s "$dev" rm 1 > /dev/null 2>&1 || fail=1
+
+# Removal of mounted partition must fail.
+parted -s "$dev" rm 2 > /dev/null 2>&1 && fail=1
+
+parted -m -s "$dev" u s print > out 2>&1 || fail=1
+sed "s,^$dev,DEV," out > k; mv k out
+
+# Create expected output file.
+cat <<EOF >> exp || fail=1
+BYT;
+DEV:${n}s:dm:512:512:msdos:Linux device-mapper (linear):;
+2:1001s:200000s:199000s:fat32::lba;
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t6003-dm-hide.sh b/tests/t6003-dm-hide.sh
new file mode 100644
index 0000000..6e03622
--- /dev/null
+++ b/tests/t6003-dm-hide.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+# ensure that parted -l only shows dmraid device-mapper devices
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
+
+# Device maps names - should be random to not conflict with existing ones on
+# the system
+linear_=plinear-$$
+
+d1=
+f1=
+dev=
+cleanup_fn_() {
+ # Insist. Sometimes the initial removal fails (race?).
+ # When that happens, a second removal appears to be sufficient.
+ dmsetup remove $linear_ || dmsetup remove $linear_
+
+ test -n "$d1" && losetup -d "$d1"
+ rm -f "$f1"
+}
+
+f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
+ || fail=1
+
+# setup: create a mapping
+echo 0 2048 linear $d1 0 | dmsetup create $linear_ || fail=1
+dev=/dev/mapper/$linear_
+
+# No "DMRAID-" UUID prefix, hence the device should not show up.
+parted -s -l >out 2>&1
+grep "^Disk $dev:" out && fail=1
+
+# Unless we perform both dmsetup-remove *and* losetup -d,
+# the following dmsetup-create would fail with EBUSY.
+dmsetup remove $linear_
+losetup -d "$d1" || fail=1
+# Reopen (or get new) loop device.
+d1=$(loop_setup_ "$f1") || fail=1
+
+# This time, use a fake UUID.
+echo 0 2048 linear $d1 0 | dmsetup create $linear_ -u "DMRAID-fake-$$" || fail=1
+
+# Thus, the device should now show up.
+parted -s -l >out 2>&1
+grep "^Disk $dev:" out || fail=1
+
+Exit $fail
diff --git a/tests/t6004-dm-many-partitions.sh b/tests/t6004-dm-many-partitions.sh
new file mode 100755
index 0000000..d9a3012
--- /dev/null
+++ b/tests/t6004-dm-many-partitions.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+# device-mapper: create many partitions
+# This would not create partitions > 16 when using device-mapper
+
+# Copyright (C) 2012, 2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_udevadm_settle_
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
+
+ss=$sector_size_
+ns=300
+n_partitions=20
+start_sector=34
+loop_file=loop-file-$$
+dm_name=dm-test-$$
+
+cleanup_() {
+ dmsetup remove $dm_name
+ test -n "$dev" && losetup -d "$dev"
+ rm -f $loop_file;
+}
+
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$loop_file bs=$ss seek=$ns || framework_failure
+dev=$(losetup --show -f $loop_file) || framework_failure
+dmsetup create $dm_name --table "0 $ns linear $dev 0" || framework_failure
+
+cmd=
+for ((i=1; i<=$n_partitions; i+=1)); do
+ s=$((start_sector + i - 1))
+ cmd="$cmd mkpart p$i ${s}s ${s}s"
+done
+parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fail=1
+
+# Make sure all the partitions appeared under /dev/mapper/
+for ((i=1; i<=$n_partitions; i+=1)); do
+ wait_for_dev_to_appear_ "/dev/mapper/${dm_name}p$i" || { fail=1; break; }
+
+ # remove the partitions as we go, otherwise cleanup won't work.
+ dmsetup remove /dev/mapper/${dm_name}p$i
+done
+
+Exit $fail
diff --git a/tests/t6005-dm-uuid.sh b/tests/t6005-dm-uuid.sh
new file mode 100755
index 0000000..caa992c
--- /dev/null
+++ b/tests/t6005-dm-uuid.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+# device-mapper: preserve uuid
+# The dm's partitions uuid would be removed when creating new partitions
+
+# Copyright (C) 2012, 2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_udevadm_settle_
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
+
+ss=$sector_size_
+ns=300
+n_partitions=3
+start_sector=34
+loop_file=loop-file-$$
+dm_name=dm-test-$$
+
+cleanup_() {
+ dmsetup remove $dm_name
+ test -n "$dev" && losetup -d "$dev"
+ rm -f $loop_file;
+}
+
+# create a file large enough to hold a GPT partition table
+dev=$(loop_setup_ $loop_file) || framework_failure
+dmsetup create $dm_name --table "0 $ns linear $dev 0" || framework_failure
+dmsetup rename $dm_name --setuuid f139317b-f98a-45d7-ab3b-9b4e0a336872 || framework_failure
+
+cmd=
+for ((i=1; i<=$n_partitions; i+=1)); do
+ s=$((start_sector + i - 1))
+ cmd="$cmd mkpart p$i ${s}s ${s}s"
+done
+parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fail=1
+wait_for_dev_to_appear_ /dev/mapper/${dm_name}p${n_partitions} || fail=1
+
+# Make sure all the partitions have UUIDs
+for ((i=1; i<=$n_partitions; i+=1)); do
+ dmsetup info /dev/mapper/${dm_name}p$i | grep UUID || fail=1
+
+ # remove the partitions as we go, otherwise cleanup won't work.
+ dmsetup remove /dev/mapper/${dm_name}p$i
+done
+
+Exit $fail
diff --git a/tests/t6006-dm-512b-sectors.sh b/tests/t6006-dm-512b-sectors.sh
new file mode 100644
index 0000000..5f2f291
--- /dev/null
+++ b/tests/t6006-dm-512b-sectors.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+# device-mapper sector sizes are 512b, make sure partitions are the correct
+# size when using larger sector sizes and a linear dm table.
+
+# Copyright (C) 2015, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_ 'this system lacks a new-enough libblkid'
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
+
+# Device maps names - should be random to not conflict with existing ones on
+# the system
+linear_=plinear-$$test
+
+cleanup_fn_() {
+ i=0
+ udevadm settle
+ while [ $i -lt 10 ] ; do
+ [ -e "/dev/mapper/${linear_}1" ] && dmsetup remove ${linear_}1
+ sleep .2
+ [ -e "/dev/mapper/$linear_" ] && dmsetup remove $linear_
+ sleep .2
+ [ -e "/dev/mapper/${linear_}1" ] || [ -e "/dev/mapper/$linear_" ] || i=10
+ i=$((i + 1))
+ done
+ udevadm settle
+}
+
+# Create a 10M device
+ss=$sector_size_
+scsi_debug_setup_ sector_size=$ss dev_size_mb=11 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+# Size of device, in 512b units
+scsi_dev_size=$(blockdev --getsz $scsi_dev) || framework_failure
+
+dmsetup create $linear_ --table "0 $scsi_dev_size linear $scsi_dev 0" || framework_failure
+dev="/dev/mapper/$linear_"
+
+# Create msdos partition table with a partition from 1MiB to 10MiB
+parted -s $dev mklabel msdos mkpart primary ext2 1MiB 100% > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+wait_for_dev_to_appear_ ${dev}1 || fail=1
+
+# The size of the partition should be 10MiB, or 20480 512b sectors
+p1_size=$(blockdev --getsz ${dev}1) || framework_failure
+[ $p1_size == 20480 ] || fail=1
+
+Exit $fail
diff --git a/tests/t6100-mdraid-partitions.sh b/tests/t6100-mdraid-partitions.sh
new file mode 100755
index 0000000..824a4ce
--- /dev/null
+++ b/tests/t6100-mdraid-partitions.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+# verify that new kernel is informed about partitions on mdraid devices
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+require_mdadm_
+
+# create memory-backed device
+scsi_debug_setup_ dev_size_mb=10 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+# Arbitrary number, not likely to be used already
+md_name=md99
+md_dev=/dev/$md_name
+
+test -b $md_dev && skip_ "$md_dev already exists"
+
+# Use gpt and create two partitions on the device.
+parted -s "$scsi_dev" mklabel gpt \
+ mkpart p1 ext2 1M 4M \
+ mkpart p2 ext2 5M 8M > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+wait_for_dev_to_appear_ ${scsi_dev}2 || { fail=1; cat /proc/partitions; }
+
+cleanup_fn_() {
+ # stop mdraid array
+ mdadm -S $md_dev || warn_ "Failed to stop MD array, $md_dev"
+}
+
+# create mdraid on top of both partitions with v0.90 metadata
+mdadm -C $md_dev -e0 --force -R -l1 -n2 "${scsi_dev}1" "${scsi_dev}2"
+wait_for_dev_to_appear_ ${md_dev} || { fail=1; cat /proc/partitions; }
+
+# create gpt and two partitions on the raid device
+parted -s $md_dev mklabel gpt \
+ mkpart r1 ext2 1M 2M \
+ mkpart r2 ext2 2M 3M > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# Verify that kernel has been informed about the second device.
+wait_for_dev_to_appear_ ${md_dev}p2 || { fail=1; cat /proc/partitions; }
+
+# Remove partitions from the raid device.
+parted -s $md_dev rm 2 rm 1 > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# Verify that kernel has been informed about those removals.
+wait_for_dev_to_disappear_ ${md_dev}p1 2 || { fail=1; cat /proc/partitions; }
+wait_for_dev_to_disappear_ ${md_dev}p2 2 || { fail=1; cat /proc/partitions; }
+
+Exit $fail
diff --git a/tests/t7000-scripting.sh b/tests/t7000-scripting.sh
new file mode 100755
index 0000000..cc7b3ee
--- /dev/null
+++ b/tests/t7000-scripting.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+# Make sure the scripting option works (-s) properly.
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+N=100 # number of sectors
+
+: ${abs_top_builddir=$(cd ../..; pwd)}
+: ${CONFIG_HEADER="$abs_top_builddir/lib/config.h"}
+
+config_h=$abs_top_srcdir
+grep '^#define HAVE_LIBREADLINE 1' $CONFIG_HEADER > /dev/null \
+ || skip_ "configured without readline support"
+
+# The failure messages.
+cat << EOF > err.expected || fail=1
+Error: You requested a partition from 512B to 50.7kB (sectors 0..0).
+The closest location we can manage is 17.4kB to 33.8kB (sectors 0..0).
+EOF
+
+normalize_part_diag_ err.expected || fail=1
+
+{ emit_superuser_warning
+ sed s/Error/Warning/ err.expected
+ printf 'Is this still acceptable to you?\nYes/No?'; } >> errI || fail=1
+
+for mkpart in mkpart; do
+
+ # Test for mkpart in scripting mode
+ # Create the test file
+ dd if=/dev/zero of=testfile bs=${ss}c count=$N 2> /dev/null || fail=1
+
+ # Test the scripting mode of $mkpart.
+ parted -s testfile -- mklabel gpt "$mkpart" p-name ext3 1s -34s > out 2>&1
+ test $? = 1 || fail=1
+
+ # Compare the real error and the expected one
+ normalize_part_diag_ out || fail=1
+ compare err.expected out || fail=1
+
+ # Test mkpart interactive mode.
+ # Create the test file
+ rm -f testfile
+ dd if=/dev/zero of=testfile bs=${ss}c count=$N 2> /dev/null || fail=1
+ # Test the interactive mode of $mkpart
+ echo n | \
+ parted ---pretend-input-tty -- testfile \
+ mklabel gpt $mkpart p-name ext3 1s -34s > out 2>&1 && fail=1
+
+ # We have to format the output before comparing.
+ # normalize the actual output
+ printf x >> out || fail=1
+ sed "s, * ,,g;s, x$,,;/ n$/ {N;s, n\nx,,}" out > o2 && mv -f o2 out \
+ || fail=1
+ normalize_part_diag_ out || fail=1
+
+ # Compare the real error and the expected one
+ compare out errI || fail=1
+
+done
+
+Exit $fail
diff --git a/tests/t8000-loop.sh b/tests/t8000-loop.sh
new file mode 100755
index 0000000..793e279
--- /dev/null
+++ b/tests/t8000-loop.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Test usage of loop devices
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+lvm_init_root_dir_
+
+d1= f1=
+cleanup_fn_()
+{
+ test -n "$d1" && losetup -d "$d1"
+ rm -f "$f1"
+}
+
+f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
+ || skip_ "is this partition mounted with 'nodev'?"
+
+require_partitionable_loop_device_ $d1
+
+# Expect this to succeed.
+parted -s $d1 mklabel msdos > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+
+# Create a partition
+parted -s $d1 mkpart primary 1 10 > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+
+Exit $fail
diff --git a/tests/t8001-loop-blkpg.sh b/tests/t8001-loop-blkpg.sh
new file mode 100755
index 0000000..5b7b891
--- /dev/null
+++ b/tests/t8001-loop-blkpg.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+# Test support for partitions on loop devices
+
+# Copyright (C) 2008-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_udevadm_settle_
+lvm_init_root_dir_
+
+cleanup_fn_()
+{
+ test -n "$loopdev" \
+ && { udevadm settle --timeout=3; losetup -d "$loopdev"; }
+}
+
+# Create backing file
+dd if=/dev/zero of=backing_file bs=1M count=4 >/dev/null 2>&1 || fail=1
+
+# Set up loop device on top of backing file
+loopdev=$(loop_setup_ backing_file)
+test -z "$loopdev" && fail=1
+
+# Skip this test if loop devices are not partitionable.
+require_partitionable_loop_device_ $loopdev
+
+# Expect this to succeed
+parted -s "$loopdev" mklabel msdos > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+
+# Create a partition
+parted -s "$loopdev" mkpart primary 1M 2M > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+udevadm settle --timeout=5 || fail=1
+
+# Verify that the partition appeared in /proc/partitions
+entry=$(basename "$loopdev"p1)
+grep "$entry" /proc/partitions || { cat /proc/partitions; fail=1; }
+
+# Remove the partition
+parted -s "$loopdev" rm 1 > err 2>&1 || fail=1
+compare /dev/null err || fail=1 # expect no output
+udevadm settle --timeout=5 || fail=1
+
+# Verify that the partition got removed from /proc/partitions
+grep "$entry" /proc/partitions && fail=1
+
+Exit $fail
diff --git a/tests/t9010-big-sector.sh b/tests/t9010-big-sector.sh
new file mode 100755
index 0000000..4f53533
--- /dev/null
+++ b/tests/t9010-big-sector.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# check physical sector size as reported by 'print'
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_ 'this system lacks a new-enough libblkid'
+
+echo 'Sector size (logical/physical): 4096B/4096B' > exp || framework_failure
+
+# create memory-backed device
+scsi_debug_setup_ dev_size_mb=8 sector_size=4096 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+# create partition table and print
+parted -s $scsi_dev mklabel gpt print > out 2>&1 || fail=1
+grep '^Sector' out > k 2>&1 || fail=1
+mv k out || fail=1
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t9020-alignment.sh b/tests/t9020-alignment.sh
new file mode 100755
index 0000000..85f6ba8
--- /dev/null
+++ b/tests/t9020-alignment.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# verify that new alignment-querying functions work
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_ 'this system lacks a new-enough libblkid'
+
+cat <<EOF > exp || framework_failure
+minimum: 7 8
+optimal: 7 2048
+partition alignment: 0 1
+EOF
+
+# create memory-backed device
+scsi_debug_setup_ physblk_exp=3 lowest_aligned=7 num_parts=4 > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+# print alignment info
+../print-align $scsi_dev > out 2>&1 || fail=1
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t9021-maxima.sh b/tests/t9021-maxima.sh
new file mode 100755
index 0000000..499af8a
--- /dev/null
+++ b/tests/t9021-maxima.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+# verify that partition maxima-querying functions work
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+dev=dev-file
+PATH="..:$PATH"
+export PATH
+
+max_n_partitions()
+{
+ case $1 in
+
+ # Technically, msdos partition tables have no limit on the maximum number
+ # of partitions, but we pretend it is 64 due to implementation details.
+ msdos) m=64;;
+
+ gpt) m=128;;
+ dvh) m=16;;
+ sun) m=8;;
+ mac) m=65536;;
+ bsd) m=8;;
+ amiga) m=128;;
+ atari) m=12;;
+ loop) m=1;;
+ pc98) case $ss in 512) m=16;; *) m=64;; esac;;
+ *) warn_ invalid partition table type: $1 1>&2; exit 1;;
+ esac
+ echo $m
+}
+
+# FIXME: add aix when/if it's supported again
+for t in msdos gpt dvh sun mac bsd amiga atari loop pc98; do
+ echo $t
+ [ $t = 'atari' ] && [ $ss != 512 ] && continue
+ rm -f $dev
+ dd if=/dev/zero of=$dev bs=$ss count=1 seek=10000 || { fail=1; continue; }
+ parted -s $dev mklabel $t || { fail=1; continue; }
+
+ #case $t in pc98) sleep 999d;; esac
+
+ max_start=4294967295
+ max_len=4294967295
+ case $t in
+ atari) max_start=2147483647; max_len=$max_start;;
+ gpt|loop) max_start=18446744073709551615; max_len=$max_start;;
+ sun) max_start=549755813760;; # 128 * (2^32-1)
+ esac
+
+ print-max $dev > out 2>&1 || fail=1
+ m=$(max_n_partitions $t) || fail=1
+ printf '%s\n' "max len: $max_len" \
+ "max start sector: $max_start" \
+ "max number of partitions: $m" \
+ > exp || fail=1
+ compare exp out || fail=1
+done
+
+Exit $fail
diff --git a/tests/t9022-one-unit-snap.sh b/tests/t9022-one-unit-snap.sh
new file mode 100644
index 0000000..decd41f
--- /dev/null
+++ b/tests/t9022-one-unit-snap.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Confirm that specifying 1 unit snaps to the correct value
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+n_sectors=3000
+dev=dev-file
+
+# Create an example of what the result should look like
+# start should be at 1 sector.
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel msdos mkpart pri 1s $((1000*1000))B \
+ > err 2>&1 || fail=1
+compare /dev/null err || fail=1
+parted -m -s $dev u s p > exp || fail=1
+
+rm $dev
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel msdos mkpart pri 0 1MB \
+ > err 2>&1 || fail=1
+compare /dev/null err || fail=1
+parted -m -s $dev u s p > out || fail=1
+
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t9023-value-lt-one.sh b/tests/t9023-value-lt-one.sh
new file mode 100644
index 0000000..567f2ba
--- /dev/null
+++ b/tests/t9023-value-lt-one.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Confirm that a value between 0 and 1 throws an error
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+n_sectors=3000
+dev=dev-file
+
+echo 'Error: Use a smaller unit instead of a value < 1' > exp
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel msdos mkpart pri 0 0.5MB \
+ > err 2>&1
+compare exp err || fail=1
+
+Exit $fail
diff --git a/tests/t9024-msdos-1s-partition.sh b/tests/t9024-msdos-1s-partition.sh
new file mode 100644
index 0000000..cc63476
--- /dev/null
+++ b/tests/t9024-msdos-1s-partition.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Test creating 1s partitions in 1s free space
+
+# Copyright (C) 2022-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+
+# create device
+truncate --size 10MiB "$dev" || fail=1
+
+# create msdos label and some partitions with 1s free space between
+parted --script "$dev" mklabel msdos > out 2>&1 || fail=1
+parted --script "$dev" mkpart primary ext4 64s 128s > out 2>&1 || fail=1
+parted --script "$dev" mkpart primary ext4 130s 200s > out 2>&1 || fail=1
+parted --script "$dev" u s p free
+
+# Free space is at 129s
+parted --script "$dev" mkpart primary ext4 129s 129s > out 2>&1 || fail=1
+parted --script "$dev" u s p free
+
+Exit $fail
diff --git a/tests/t9025-gpt-1s-partition.sh b/tests/t9025-gpt-1s-partition.sh
new file mode 100644
index 0000000..04a3e4e
--- /dev/null
+++ b/tests/t9025-gpt-1s-partition.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Test creating 1s partitions in 1s free space
+
+# Copyright (C) 2022-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+
+# create device
+truncate --size 10MiB "$dev" || fail=1
+
+# create msdos label and some partitions with 1s free space between
+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1
+parted --script "$dev" mkpart p1 ext4 64s 128s > out 2>&1 || fail=1
+parted --script "$dev" mkpart p2 ext4 130s 200s > out 2>&1 || fail=1
+parted --script "$dev" u s p free
+
+# Free space is at 129s
+parted --script "$dev" mkpart p3 ext4 129s 129s > out 2>&1 || fail=1
+parted --script "$dev" u s p free
+
+Exit $fail
diff --git a/tests/t9030-align-check.sh b/tests/t9030-align-check.sh
new file mode 100644
index 0000000..4954f44
--- /dev/null
+++ b/tests/t9030-align-check.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+# exercise the align-check command
+
+# Copyright (C) 2009-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+ss=$sector_size_
+
+require_root_
+require_scsi_debug_module_
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_ 'this system lacks a new-enough libblkid'
+
+# create memory-backed device
+scsi_debug_setup_ physblk_exp=3 lowest_aligned=7 sector_size=$ss > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+p1=${scsi_dev}1
+
+parted -s $scsi_dev mklabel gpt || fail=1
+
+i=60
+while :; do
+ parted -s $scsi_dev mkpart p1 ext2 ${i}s 800s || fail=1
+ wait_for_dev_to_appear_ $p1 || fail=1
+ parted -s $scsi_dev align-check min 1 > out 2>&1
+ result=$?
+
+ test $(expr $i % 8) = 7 && exp_result=0 || exp_result=1
+ test $result = $exp_result || fail=1
+ compare /dev/null out || fail=1
+
+ parted -s $scsi_dev rm 1
+ i=$(expr $i + 1)
+ test $i = 70 && break
+
+ # Wait up to 10s for the partition file to disappear.
+ wait_for_dev_to_disappear_ $p1 10 \
+ || { fail=1; warn_ $ME_ $p1 failed to disappear; }
+done
+
+Exit $fail
diff --git a/tests/t9040-many-partitions.sh b/tests/t9040-many-partitions.sh
new file mode 100644
index 0000000..31b6030
--- /dev/null
+++ b/tests/t9040-many-partitions.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+# Ensure that creating many partitions works.
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_ 'this system lacks a new-enough libblkid'
+
+ss=$sector_size_
+partition_sectors=1 # sectors per partition
+n_partitions=128 # how many partitions to create
+start=34 # start sector for the first partition
+gpt_slop=34 # sectors at end of disk reserved for GPT
+
+n_sectors=$(($start + n_partitions * partition_sectors + gpt_slop))
+
+sectors_per_MiB=$((1024 * 1024 / ss))
+n_MiB=$(((n_sectors + sectors_per_MiB - 1) / sectors_per_MiB))
+# create memory-backed device
+scsi_debug_setup_ sector_size=$ss dev_size_mb=$n_MiB > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+n=$((n_MiB * sectors_per_MiB))
+printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug:;\n" \
+ > exp || fail=1
+
+cmd=
+i=1
+while :; do
+ s=$((start + i - 1))
+ e=$((s + partition_sectors - 1))
+ cmd="$cmd mkpart p$i ${s}s ${e}s"
+ test $i = $n_partitions && break; i=$((i+1))
+done
+
+# Time the actual command:
+parted -m -a min -s $scsi_dev mklabel gpt $cmd u s p > out 2>&1 || fail=1
+
+i=1
+while :; do
+ s=$((start + i - 1))
+ e=$((s + partition_sectors - 1))
+ printf "$i:${s}s:${e}s:${partition_sectors}s::p$i:;\n" >> exp
+ test $i = $n_partitions && break; i=$((i+1))
+done
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t9041-undetected-in-use-16th-partition.sh b/tests/t9041-undetected-in-use-16th-partition.sh
new file mode 100644
index 0000000..a16f14d
--- /dev/null
+++ b/tests/t9041-undetected-in-use-16th-partition.sh
@@ -0,0 +1,99 @@
+#!/bin/sh
+# Ensure that parted knows when N'th (N>=16) partition is mounted
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_ 'this system lacks a new-enough libblkid'
+
+ss=$sector_size_
+partition_sectors=512 # sectors per partition
+n_partitions=17 # how many partitions to create
+start=2048 # start sector for the first partition
+gpt_slop=34 # sectors at end of disk reserved for GPT
+
+n_sectors=$(($start + n_partitions * partition_sectors + gpt_slop))
+
+sectors_per_MiB=$((1024 * 1024 / ss))
+n_MiB=$(((n_sectors + sectors_per_MiB - 1) / sectors_per_MiB))
+# create memory-backed device
+scsi_debug_setup_ sector_size=$ss dev_size_mb=$n_MiB > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+n=$((n_MiB * sectors_per_MiB))
+printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug:;\n" \
+ > exp || fail=1
+
+parted -s $scsi_dev mklabel gpt || fail=1
+parted -s $scsi_dev u s p || fail=1
+
+i=1
+t0=$(date +%s.%N)
+while :; do
+ end=$((start + partition_sectors - 1))
+ parted -s $scsi_dev mkpart p$i ${start}s ${end}s || fail=1
+ printf "$i:${start}s:${end}s:${partition_sectors}s::p$i:;\n" >> exp
+ test $i = $n_partitions && break
+ start=$((start + partition_sectors))
+ i=$((i+1))
+done
+t_final=$(date +%s.%N)
+
+# Fail the test if it takes too long.
+# On Fedora 13, it takes about 15 seconds.
+# With older kernels, it typically takes more than 150 seconds.
+$AWK "BEGIN {d = $t_final - $t0; n = $n_partitions; st = 60 < d;"\
+' printf "created %d partitions in %.2f seconds\n", n, d; exit st }' /dev/null \
+ || fail=1
+
+parted -m -s $scsi_dev u s p > out || fail=1
+compare exp out || fail=1
+
+wait_for_dev_to_appear_ ${scsi_dev}16 || fail_ ${scsi_dev}16 did not appear
+
+partitions="${scsi_dev}14 ${scsi_dev}15 ${scsi_dev}16"
+for i in $partitions; do
+ mkfs.ext3 $i || fail=1
+done
+
+# be sure to unmount upon interrupt, failure, etc.
+cleanup_fn_() { for i in $partitions; do umount "$i" > /dev/null 2>&1; done; }
+
+for part_dev in $partitions; do
+ n=${part_dev#$scsi_dev}
+ mount_point=$(pwd)/m-$n
+ mkdir $mount_point || fail=1
+ mount "$part_dev" "$mount_point" || fail=1
+
+ # Removal of mounted partition must fail.
+ parted -s $scsi_dev rm $n > out 2>&1 && fail=1
+
+ echo "Warning: Partition $part_dev is being used." \
+ 'Are you sure you want to continue?' \
+ > exp-error || framework_failure_
+
+ # expect error
+ compare exp-error out || fail=1
+
+done
+
+Exit $fail
diff --git a/tests/t9042-dos-partition-limit.sh b/tests/t9042-dos-partition-limit.sh
new file mode 100644
index 0000000..459cb6b
--- /dev/null
+++ b/tests/t9042-dos-partition-limit.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+# Ensure that parted enforces msdos partition limit
+
+# Copyright (C) 2010-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+require_scsi_debug_module_
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_ 'this system lacks a new-enough libblkid'
+
+ss=$sector_size_
+partition_sectors=256 # sectors per partition
+n_partitions=61 # how many partitions to create
+start=2048 # start sector for the first partition
+
+n_sectors=$(($start + n_partitions * partition_sectors))
+
+sectors_per_MiB=$((1024 * 1024 / ss))
+n_MiB=$(((n_sectors + sectors_per_MiB - 1) / sectors_per_MiB))
+# create memory-backed device
+scsi_debug_setup_ sector_size=$ss dev_size_mb=$n_MiB > dev-name ||
+ skip_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+n=$((n_MiB * sectors_per_MiB))
+printf '%s\n' "BYT;" \
+ "$scsi_dev:${n}s:scsi:$ss:$ss:msdos:Linux scsi_debug:;" \
+ "1:$((start-2))s:$((n-1))s:$((n-start+2))s:::lba;" \
+ > exp || fail=1
+
+parted -s -a min $scsi_dev mklabel msdos mkpart extended $((start-2))s 100% || fail=1
+wait_for_dev_to_appear_ ${scsi_dev}1 || fail=1
+
+i=1
+while :; do
+ end=$((start + partition_sectors - 2))
+ parted -s -a min $scsi_dev mkpart logical ${start}s ${end}s || fail=1
+ printf "$((i+4)):${start}s:${end}s:$((end-start+1))s:::;\n" >> exp
+ test $i = $((n_partitions - 1)) && break
+ start=$((start + partition_sectors))
+ i=$((i+1))
+done
+
+parted -m -s $scsi_dev u s p > out || fail=1
+compare exp out || fail=1
+
+start=$((start + partition_sectors))
+end=$((start + partition_sectors - 2))
+
+#try one more partition than allowed, make sure it fails
+
+parted -s -a min $scsi_dev mkpart logical ${start}s ${end}s > out 2>&1
+cat <<EOF > exp
+Error: cannot create any more partitions
+EOF
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t9050-partition-table-types.sh b/tests/t9050-partition-table-types.sh
new file mode 100755
index 0000000..0c2dbe7
--- /dev/null
+++ b/tests/t9050-partition-table-types.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# Ensure that any combination of partition table types works.
+# I.e., write a partition table of type T, and then overwrite it
+# with one of type V, for every permutation of T and V.
+
+# Copyright (C) 2011-2014, 2019-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+not_yet='
+aix
+'
+
+types='
+bsd
+msdos
+dvh
+gpt
+loop
+mac
+pc98
+sun
+mkswap
+'
+N=1M
+dev=loop-file
+
+cleanup_() {
+ rm -f $dev;
+}
+
+dd if=/dev/zero of=$dev bs=$N count=30 || framework_failure_
+
+for i in $types; do
+ for j in $types; do
+ echo $i:$j
+ case $i in mkswap) mkswap $dev || fail=1;;
+ *) parted -s $dev mklabel $i || fail=1;; esac
+ case $j in mkswap) continue;; esac
+ parted -s $dev mklabel $j || fail=1
+ done
+done
+
+Exit $fail
diff --git a/tests/t9060-gpt-grow-script-fix.sh b/tests/t9060-gpt-grow-script-fix.sh
new file mode 100755
index 0000000..efdb1e4
--- /dev/null
+++ b/tests/t9060-gpt-grow-script-fix.sh
@@ -0,0 +1,100 @@
+#!/bin/sh
+# grow a gpt disk, ensure that parted offers to update the gpt size
+# do this in script mode with fix
+
+# Copyright (C) 2009-2012, 2014, 2019, 2022-2023 Free Software Foundation, Inc.
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+dev=loop-file
+
+ss=$sector_size_
+n_sectors=5000
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+# create gpt label
+parted -s $dev mklabel gpt > empty 2>&1 || fail=1
+compare /dev/null empty || fail=1
+
+# print the empty table
+parted -m -s $dev unit s print > t 2>&1 || fail=1
+sed "s,.*/$dev:,$dev:," t > out || fail=1
+
+# check for expected output
+printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \
+ > exp || fail=1
+compare exp out || fail=1
+
+# grow disk
+n_sectors=5500
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+# printing must warn, but not fix in script mode
+parted -s $dev print > out 2>&1 || fail=1
+
+# Transform the actual output, to avoid spurious differences when
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \
+ -e "s,^.*/lt-parted: ,parted: ," o2 > out
+
+# check for expected diagnostic
+cat <<EOF > exp || fail=1
+Warning: Not all of the space available to DEVICE appears to be used, you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting?
+Model: (file)
+Disk DEVICE: 2816kB
+Sector size (logical/physical): 512B/512B
+Partition Table: gpt
+Disk Flags:
+
+Number Start End Size File system Name Flags
+
+EOF
+compare exp out || fail=1
+
+# now we fix
+parted --script --fix $dev print > out 2>&1 || fail=1
+
+# Transform the actual output, to avoid spurious differences when
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \
+ -e "s,^.*/lt-parted: ,parted: ," o2 > out
+
+# check for expected diagnostic
+cat <<EOF > exp || fail=1
+Warning: Not all of the space available to DEVICE appears to be used, you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting?
+Fixing, due to --fix
+Model: (file)
+Disk DEVICE: 2816kB
+Sector size (logical/physical): 512B/512B
+Partition Table: gpt
+Disk Flags:
+
+Number Start End Size File system Name Flags
+
+EOF
+compare exp out || fail=1
+
+
+# Now should not warn
+
+parted -s $dev print > err 2>&1 || fail=1
+grep Warning: err > k ; mv k err
+compare /dev/null err || fail=1
+
+Exit $fail