static void
run_test (const char *dev)
{
- int fd;
+ int fd, passno;
uint64_t size;
ssize_t r;
printf ("init: testing %s\n", dev);
- fflush (stdout);
- fd = open (dev, O_RDONLY);
- if (fd == -1) {
- perror (dev);
- _exit (EXIT_FAILURE);
- }
- if (ioctl (fd, BLKGETSIZE64, &size) == -1) {
- perror ("ioctl: BLKGETSIZE64");
- _exit (EXIT_FAILURE);
- }
+ for (passno = 0; passno < 5; ++passno) {
+ printf ("init: %s: pass %d\n", dev, passno);
+ fflush (stdout);
- while (size > 0) {
- r = read (fd, buffer, MIN (BUFSIZ, size));
- if (r == -1) {
- perror ("read");
+ fd = open (dev, O_RDONLY);
+ if (fd == -1) {
+ perror (dev);
+ _exit (EXIT_FAILURE);
+ }
+ if (ioctl (fd, BLKGETSIZE64, &size) == -1) {
+ perror ("ioctl: BLKGETSIZE64");
_exit (EXIT_FAILURE);
}
- size -= r;
- }
- if (close (fd) == -1) {
- perror ("close");
- _exit (EXIT_FAILURE);
+ while (size > 0) {
+ r = read (fd, buffer, MIN (BUFSIZ, size));
+ if (r == -1) {
+ perror ("read");
+ _exit (EXIT_FAILURE);
+ }
+ size -= r;
+ }
+
+ if (close (fd) == -1) {
+ perror ("close");
+ _exit (EXIT_FAILURE);
+ }
}
printf ("init: test of %s finished successfully\n", dev);