[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH libext2 7/8] 67: Bootloader muss beim Superblock-Update erhalten werden



Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 tests/67_keep_bootloader/image.bz2 | Bin 0 -> 365 bytes
 tests/67_keep_bootloader/test.c    |  40 +++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 tests/67_keep_bootloader/image.bz2
 create mode 100644 tests/67_keep_bootloader/test.c

diff --git a/tests/67_keep_bootloader/image.bz2 b/tests/67_keep_bootloader/image.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..7082e46b0bff3416ec4db964bc458dc97f182ba0
GIT binary patch
literal 365
zcmV-z0h0bgT4*^jL0KkKSt6>$`v4$-fB*dcz>q)<0LbEkT2LiN&LChQQXv8W5JJ!Z
z08lYzlvuC<HW-FQ2%2f8Mi9skN$Oxg^&3cOvYKsAME072qMB(2AOWBN27^E{Gynhu
zQYv~)q&ARbGzNj70iXZ?0C5!%e@(@rKvgTsVltwFR9Mc#2qQ8j%m9-B02DGHFWS31
zgd!zS2!O1s<LA~U%z(*&%9O3ci*mF??Z%V^5%pSBL4qe0TBc~Ks^daa0M&X$h!9m)
z-4djLy9}UdgtbJ4lui(@4V{@T2t^fE%~$*|kE;@KJ0&<`8_{H$mom4)q67Ay=mqeV
z5Y0_N85umSv?+1QqE8p>ghBZ5+?z*BTx3f*C+mYtx`{9!P&6n8jckidd^X`K`l0})
z+%oHT`(lM+ktfc_CXKC~=ytV)muR}JN1D7z1$yoR;t~N>Zv=&Zp#Yo!2C%K3Kk;`Y
LQ-uivDy&bitFf2}

literal 0
HcmV?d00001

diff --git a/tests/67_keep_bootloader/test.c b/tests/67_keep_bootloader/test.c
new file mode 100644
index 0000000..93cfaad
--- /dev/null
+++ b/tests/67_keep_bootloader/test.c
@@ -0,0 +1,40 @@
+#include <ext2.h>
+#include <string.h>
+#include <stdio.h>
+#include <test.h>
+
+/**
+ * Test: keep_bootloader
+ * Autor: Kevin Wolf
+ * Zweck: Beim Superblock-Update muss der Bootloader heil bleiben
+ */
+int run_test(ext2_fs_t* fs)
+{
+    ext2_superblock_t sb;
+    char buf[1024], pattern[1024];
+
+    memset(buf, 0, 1024);
+    memset(pattern, 0x5a, 1024);
+
+    ext2_fs_mount(fs);
+
+    if (!ext2_sb_read(fs, &sb)) {
+        test_error("Superblock konnte nicht eingelesen werden");
+    }
+
+    if (!ext2_sb_update(fs, &sb)) {
+        test_error("Superblock konnte nicht geschrieben werden");
+    }
+
+    ext2_fs_sync(fs);
+
+    if (!fs->dev_read(0, 1024, buf, fs->dev_private)) {
+        test_error("Fehler beim Lesen vom Image");
+    }
+
+    if (memcmp(pattern, buf, 1024)) {
+        test_error("Der Bootloader sieht kaputt aus");
+    }
+
+    return 0;
+}
-- 
1.8.1.4