Package: parted / 3.2-17

tests-move-get-sector-size.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
From ff8c1acab7041113768d76d52c7954b68d6a72a8 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: 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>

Bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16134
Bug-Debian: https://bugs.debian.org/239816
Last-Update: 2016-12-09

Patch-Name: tests-move-get-sector-size.patch
---
 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 a0be9978..91156864 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 1b1c8014..5d7485ed 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 48561b95..62d20c1e 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)
 {