* This testing program makes sure the badblocks implementation works.
*
* Copyright (C) 1996 by Theodore Ts'o.
- *
+ *
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
11, 0,
12, 1,
13, 1,
- 14, 0,
+ 14, 0,
80, 0,
45, 0,
66, 1,
1, DEL_BLK,
0
};
-
+
static int test_fail = 0;
static int test_expected_fail = 0;
errcode_t retval;
badblocks_list bb;
int i;
-
+
retval = ext2fs_badblocks_list_create(&bb, 5);
if (retval) {
com_err("create_test_list", retval, "while creating list");
badblocks_iterate iter;
blk_t blk;
int i, ok;
-
+
retval = ext2fs_badblocks_list_iterate_begin(bb, &iter);
if (retval) {
com_err("print_list", retval, "while setting up iterator");
ext2fs_badblocks_list_del(bb, vec[i]);
match = ext2fs_badblocks_list_test(bb, vec[i]);
printf("Removing block %u --- now %s\n", vec[i],
- ext2fs_badblocks_list_test(bb, vec[i]) ?
+ ext2fs_badblocks_list_test(bb, vec[i]) ?
"present" : "absent");
if (match) {
printf("FAILURE!\n");
printf("Expected test failure didn't happen!\n");
test_fail++;
}
-
+
if (ext2fs_badblocks_equal(bb, new_bb)) {
printf("Block bitmap matched after reading and writing.\n");
if (retval == 0)
print_list(bb1, 1);
printf("\n");
-
+
printf("test2: ");
retval = create_test_list(test2, &bb2);
if (retval == 0)
if (retval == 0)
print_list(bb3, 1);
printf("\n");
-
+
printf("test4: ");
retval = create_test_list(test4, &bb4);
if (retval == 0) {
if (bb1 && bb2 && bb3 && bb4 && bb5) {
printf("Comparison tests:\n");
equal = ext2fs_badblocks_equal(bb1, bb2);
- printf("bb1 and bb2 are %sequal.\n", equal ? "" : "NOT ");
+ printf("bb1 and bb2 are %sequal.\n", equal ? "" : "NOT ");
if (equal)
test_fail++;
equal = ext2fs_badblocks_equal(bb1, bb3);
- printf("bb1 and bb3 are %sequal.\n", equal ? "" : "NOT ");
+ printf("bb1 and bb3 are %sequal.\n", equal ? "" : "NOT ");
if (!equal)
test_fail++;
-
+
equal = ext2fs_badblocks_equal(bb1, bb4);
- printf("bb1 and bb4 are %sequal.\n", equal ? "" : "NOT ");
+ printf("bb1 and bb4 are %sequal.\n", equal ? "" : "NOT ");
if (equal)
test_fail++;
equal = ext2fs_badblocks_equal(bb4, bb5);
- printf("bb4 and bb5 are %sequal.\n", equal ? "" : "NOT ");
+ printf("bb4 and bb5 are %sequal.\n", equal ? "" : "NOT ");
if (!equal)
test_fail++;
printf("\n");
}
-
+
file_test(bb4);
file_test_invalid(bb4);
-
+
if (test_fail == 0)
printf("ext2fs library badblocks tests checks out OK!\n");