parted/0064-libparted-tests-Move-get_sector_size-to-common.c.patch
Brian C. Lane d75d85cc43 - Updating to upstream patches
- tests/t1701-rescue-fs wait for the device to appear. (bcl)
- Increase timeout for rmmod scsi_debug and make it a framework failure (bcl)
- libparted/dasd: add test cases for the new fdasd functions (dongdwdw)
- libparted/dasd: add an exception for changing DASD-LDL partition table (dongdwdw)
- libpartd/dasd: improve flag processing for DASD-LDL (dongdwdw)
- parted/ui: remove unneccesary information of command line (dongdwdw)
- parted: check the name of partition first when to name a partition (dongdwdw)
- Add support for RAM drives (sparschauer)
- Fix crash when localized (psusi)
- libparted: Fix typo in hfs error message (sebras)
- libparted: Fix MacOS boot support (laurent)
- mac: copy partition type and name correctly (saproj)
- libparted: Add support for atari partition tables (glaubitz)
- libparted:tests: Move get_sector_size() to common.c (glaubitz)
- tests: Update t0220 and t0280 for the swap flag. (bcl)
- libparted: set swap flag on GPT partitions (aschnell)
- libparted/dasd: add test cases for the new fdasd functions (dongdwdw)
- libparted/dasd: add new fdasd functions (dongdwdw)
- libparted/dasd: update and improve fdasd functions (dongdwdw)
- libparted/dasd: unify vtoc handling for cdl/ldl (dongdwdw)
- libparted: Don't warn if no HDIO_GET_IDENTITY ioctl (sparschauer)
- libparted: Fix starting CHS in protective MBR (petr.uzel)
- tests: Stop timing t9040 (#1172675) (bcl)
2017-05-02 09:41:50 -07:00

95 lines
2.3 KiB
Diff

From 105746f40724d94499a04a0d7036380aaa41c1f5 Mon Sep 17 00:00:00 2001
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Sun, 4 Dec 2016 17:12:45 +0100
Subject: [PATCH 64/75] libparted:tests: Move get_sector_size() to common.c
Moving get_sector_size() from disk.c to common.c allows
us to use it in _implemented_disk_label() to test for
512-byte sectors. This change is required to be able to
enable this test for atari partition tables for which
support is added in a follow-up patch.
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/tests/common.c | 14 ++++++++++++++
libparted/tests/common.h | 5 +++++
libparted/tests/disk.c | 15 ---------------
3 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/libparted/tests/common.c b/libparted/tests/common.c
index a0be997..9115686 100644
--- a/libparted/tests/common.c
+++ b/libparted/tests/common.c
@@ -7,9 +7,23 @@
#include <check.h>
#include "common.h"
+#include "xstrtol.h"
#define STREQ(a, b) (strcmp (a, b) == 0)
+size_t get_sector_size (void)
+{
+ char *p = getenv ("PARTED_SECTOR_SIZE");
+ size_t ss = 512;
+ unsigned long val;
+ if (p
+ && xstrtoul (p, NULL, 10, &val, NULL) == LONGINT_OK
+ && val % 512 == 0)
+ ss = val;
+
+ return ss;
+}
+
PedExceptionOption
_test_exception_handler (PedException* e)
{
diff --git a/libparted/tests/common.h b/libparted/tests/common.h
index 1b1c801..5d7485e 100644
--- a/libparted/tests/common.h
+++ b/libparted/tests/common.h
@@ -1,5 +1,10 @@
#include <parted/parted.h>
+/* Determine sector size from environment
+ *
+ */
+size_t get_sector_size (void);
+
/* Create an empty disk image
*
* filename: file (with full path) where to write the disk image
diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c
index 48561b9..62d20c1 100644
--- a/libparted/tests/disk.c
+++ b/libparted/tests/disk.c
@@ -7,24 +7,9 @@
#include "common.h"
#include "progname.h"
-#include "xstrtol.h"
static char* temporary_disk;
-static
-size_t get_sector_size (void)
-{
- char *p = getenv ("PARTED_SECTOR_SIZE");
- size_t ss = 512;
- unsigned long val;
- if (p
- && xstrtoul (p, NULL, 10, &val, NULL) == LONGINT_OK
- && val % 512 == 0)
- ss = val;
-
- return ss;
-}
-
static void
create_disk (void)
{
--
2.9.3