5 /* open and close disc */
6 #include "sofs_rawdisc.h"
8 #include "fsck_helper.h"
12 testfunction_t function
;
15 typedef struct test_s test_t
;
17 void main (int argc
, char *argv
[])
26 /* functions containing the tests to be made */
29 {test_sbmagic
, "sbmagic"},
30 {test_sbname
, "sbname"},
31 {test_sbzones
, "sbzones"},
32 {test_sbfctablesize
, "sbfctablesize"},
33 {test_sbciutablesize
, "sbciutablesize"},
34 {test_sbitotal
, "sbitotal"},
35 {test_infree
, "infree"},
36 {test_inused
, "inused"},
37 {test_inlost
, "inlost"},
38 {test_ininfo
, "ininfo"},
39 {test_clusterfree
, "clusterfree"},
40 {test_clusterused
, "clusterused"},
41 {test_clusterlost
, "clusterlost"},
44 if (argc
!= 2) ABORT(-EINVAL
);
45 nfuncs
= sizeof(test
)/sizeof(test_t
);
48 printf("Opening file %s as disc.\n", disc_path
);
49 fret
= soOpenDevice(disc_path
);
50 if (fret
< 0) ABORT(fret
);
51 atexit((void *)soCloseDevice
);
53 /* create internal structures */
62 for (r
= 0; (r
< nfuncs
) && (ret
== EXIT_SUCCESS
); ++r
) {
63 testres
= test
[r
].function();
66 printf("System file corrupted.\n");
70 printf("System file is weird.\n");
73 printf("Test %s passed with success.\n", test
[r
].name
);