]>
git.saurik.com Git - apple/hfs.git/blob - tests/cases/test-journal-toggle.c
1 #include <TargetConditionals.h>
9 #include "test-utils.h"
10 #include "disk-image.h"
15 #define DMG "/tmp/journal-toggle.sparseimage"
17 static disk_image_t
*di
;
18 static volatile bool run
= true;
20 void *thread1func(__unused
void *arg
)
24 asprintf(&file
, "%s/file", di
->mount_point
);
27 assert(!systemx("/usr/bin/touch", file
, NULL
));
28 assert(!systemx("/bin/rm", file
, NULL
));
34 void *thread2func(__unused
void *arg
)
37 assert(!systemx("/usr/sbin/diskutil", SYSTEMX_QUIET
, "disableJournal", di
->mount_point
, NULL
));
38 assert(!systemx("/usr/sbin/diskutil", SYSTEMX_QUIET
, "enableJournal", di
->mount_point
, NULL
));
44 int run_journal_toggle(__unused test_ctx_t
*ctx
)
46 di
= disk_image_create(DMG
, &(disk_image_opts_t
){
47 .size
= 32 * 1024 * 1024
50 pthread_t thread1
, thread2
;
51 assert(!pthread_create(&thread1
, NULL
, thread1func
, NULL
));
52 assert(!pthread_create(&thread2
, NULL
, thread2func
, NULL
));
59 assert(!pthread_join(thread1
, &ret1
));
60 assert(!pthread_join(thread2
, &ret2
));
65 #endif // !TARGET_OS_IPHONE