1 From 105746f40724d94499a04a0d7036380aaa41c1f5 Mon Sep 17 00:00:00 2001
2 From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
3 Date: Sun, 4 Dec 2016 17:12:45 +0100
4 Subject: [PATCH 64/75] libparted:tests: Move get_sector_size() to common.c
6 Moving get_sector_size() from disk.c to common.c allows
7 us to use it in _implemented_disk_label() to test for
8 512-byte sectors. This change is required to be able to
9 enable this test for atari partition tables for which
10 support is added in a follow-up patch.
12 Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
13 Signed-off-by: Brian C. Lane <bcl@redhat.com>
15 libparted/tests/common.c | 14 ++++++++++++++
16 libparted/tests/common.h | 5 +++++
17 libparted/tests/disk.c | 15 ---------------
18 3 files changed, 19 insertions(+), 15 deletions(-)
20 diff --git a/libparted/tests/common.c b/libparted/tests/common.c
21 index a0be997..9115686 100644
22 --- a/libparted/tests/common.c
23 +++ b/libparted/tests/common.c
30 #define STREQ(a, b) (strcmp (a, b) == 0)
32 +size_t get_sector_size (void)
34 + char *p = getenv ("PARTED_SECTOR_SIZE");
38 + && xstrtoul (p, NULL, 10, &val, NULL) == LONGINT_OK
46 _test_exception_handler (PedException* e)
48 diff --git a/libparted/tests/common.h b/libparted/tests/common.h
49 index 1b1c801..5d7485e 100644
50 --- a/libparted/tests/common.h
51 +++ b/libparted/tests/common.h
53 #include <parted/parted.h>
55 +/* Determine sector size from environment
58 +size_t get_sector_size (void);
60 /* Create an empty disk image
62 * filename: file (with full path) where to write the disk image
63 diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c
64 index 48561b9..62d20c1 100644
65 --- a/libparted/tests/disk.c
66 +++ b/libparted/tests/disk.c
73 static char* temporary_disk;
76 -size_t get_sector_size (void)
78 - char *p = getenv ("PARTED_SECTOR_SIZE");
82 - && xstrtoul (p, NULL, 10, &val, NULL) == LONGINT_OK