Implement binary format script (for use within kernel, where there's no scanf)
authorNick Downing <nick@ndcode.org>
Sat, 18 May 2019 02:34:56 +0000 (12:34 +1000)
committerNick Downing <nick@ndcode.org>
Sat, 18 May 2019 02:34:56 +0000 (12:34 +1000)
17 files changed:
.gitignore
Makefile
cpp.sh
indirect_core_indirect_swap/Makefile
indirect_core_indirect_swap/o.sh
indirect_core_inode_swap/Makefile
indirect_core_inode_swap/o.sh
indirect_core_preallocate_swap/Makefile
indirect_core_preallocate_swap/o.sh
moveable_core_indirect_swap/Makefile
moveable_core_indirect_swap/o.sh
moveable_core_inode_swap/Makefile
moveable_core_inode_swap/o.sh
moveable_core_preallocate_swap/Makefile
moveable_core_preallocate_swap/o.sh
process_test_gen.c
process_test_run.c

index 98ec250..be6eef0 100644 (file)
@@ -4,15 +4,18 @@
 /indirect_core_indirect_swap/*.c
 /indirect_core_indirect_swap/*.h
 /indirect_core_indirect_swap/process_test.txt
+/indirect_core_indirect_swap/process_test_gen
 /indirect_core_indirect_swap/process_test_run
 /indirect_core_inode_swap/*.c
 /indirect_core_inode_swap/*.h
 /indirect_core_inode_swap/fs.bin
 /indirect_core_inode_swap/process_test.txt
+/indirect_core_inode_swap/process_test_gen
 /indirect_core_inode_swap/process_test_run
 /indirect_core_preallocate_swap/*.c
 /indirect_core_preallocate_swap/*.h
 /indirect_core_preallocate_swap/process_test.txt
+/indirect_core_preallocate_swap/process_test_gen
 /indirect_core_preallocate_swap/process_test_run
 /inode_test.txt
 /inode_test_gen
 /moveable_core_indirect_swap/*.c
 /moveable_core_indirect_swap/*.h
 /moveable_core_indirect_swap/process_test.txt
+/moveable_core_indirect_swap/process_test_gen
 /moveable_core_indirect_swap/process_test_run
 /moveable_core_inode_swap/*.c
 /moveable_core_inode_swap/*.h
 /moveable_core_inode_swap/fs.bin
 /moveable_core_inode_swap/process_test.txt
+/moveable_core_inode_swap/process_test_gen
 /moveable_core_inode_swap/process_test_run
 /moveable_core_preallocate_swap/*.c
 /moveable_core_preallocate_swap/*.h
 /moveable_core_preallocate_swap/process_test.txt
+/moveable_core_preallocate_swap/process_test_gen
 /moveable_core_preallocate_swap/process_test_run
 /pool_test.txt
 /pool_test_gen
@@ -36,4 +42,3 @@
 /process_test.txt
 /process_test_gen
 /process_test_run
-/ucp
index 9e2e47d..c09dc7b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,4 @@
-CFLAGS=-g -Wall
-# -D__FUZIX__ -DNDEBUG
+CFLAGS=-g -Wall -D__FUZIX__ -DNDEBUG
 
 all: pool_test_gen pool_test_run process_test_gen process_test_run mkfs \
 inode_test_gen inode_test_run
@@ -19,9 +18,9 @@ pool.o: pool.c pool.h
 process_test_gen: process_test_gen.o
        ${CC} ${CFLAGS} -o $@ $^
 
-process_test_gen.o: process_test_gen.c
+process_test_gen.o: process_test_gen.c process_test.h
 
-process_test_run: process_test_run.o process.o core.o fuzix_fs_or_swap.o block_pool.o pool.o
+process_test_run: process_test_run.o process.o process_test.h core.o fuzix_fs_or_swap.o block_pool.o pool.o
        ${CC} ${CFLAGS} -o $@ $^
 
 process_test_run.o: process_test_run.c process.h core.h swap.h pool.h fuzix_fs.h util.h
diff --git a/cpp.sh b/cpp.sh
index b36dbf0..e76d81d 100755 (executable)
--- a/cpp.sh
+++ b/cpp.sh
@@ -12,6 +12,8 @@ pool.c \
 pool.h \
 process.c \
 process.h \
+process_test.h \
+process_test_gen.c \
 process_test_run.c \
 swap.c \
 swap.h
index 43180aa..7264a0d 100644 (file)
@@ -1,5 +1,12 @@
 CFLAGS=-g -Wall
 
+all: process_test_gen process_test_run
+
+process_test_gen: process_test_gen.o
+       ${CC} ${CFLAGS} -o $@ $^
+
+process_test_gen.o: process_test_gen.c process_test.h
+
 process_test_run: process_test_run.o process.o core.o swap.o block_pool.o pool.o
        ${CC} ${CFLAGS} -o $@ $^
 
index c68117c..a2d40dc 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 echo "generate test script"
-../process_test_gen 16 248 1024 32 >process_test.txt
+./process_test_gen 16 248 1024 32 >process_test.txt
 
 echo "run test script"
 ./process_test_run 16 64 192 8 384 384 <process_test.txt
index e9d3588..5bef8a8 100644 (file)
@@ -1,5 +1,12 @@
 CFLAGS=-g -Wall
 
+all: process_test_gen process_test_run
+
+process_test_gen: process_test_gen.o
+       ${CC} ${CFLAGS} -o $@ $^
+
+process_test_gen.o: process_test_gen.c process_test.h
+
 process_test_run: process_test_run.o process.o core.o fuzix_fs.o util.o block_pool.o pool.o
        ${CC} ${CFLAGS} -o $@ $^
 
index bbaadfd..ed5ff21 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 echo "generate test script"
-../process_test_gen 16 248 1024 32 >process_test.txt
+./process_test_gen 16 248 1024 32 >process_test.txt
 
 echo "run test script"
 rm -f fs.bin
index 43180aa..7264a0d 100644 (file)
@@ -1,5 +1,12 @@
 CFLAGS=-g -Wall
 
+all: process_test_gen process_test_run
+
+process_test_gen: process_test_gen.o
+       ${CC} ${CFLAGS} -o $@ $^
+
+process_test_gen.o: process_test_gen.c process_test.h
+
 process_test_run: process_test_run.o process.o core.o swap.o block_pool.o pool.o
        ${CC} ${CFLAGS} -o $@ $^
 
index c68117c..a2d40dc 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 echo "generate test script"
-../process_test_gen 16 248 1024 32 >process_test.txt
+./process_test_gen 16 248 1024 32 >process_test.txt
 
 echo "run test script"
 ./process_test_run 16 64 192 8 384 384 <process_test.txt
index 06e4155..760d3ed 100644 (file)
@@ -1,5 +1,12 @@
 CFLAGS=-g -Wall
 
+all: process_test_gen process_test_run
+
+process_test_gen: process_test_gen.o
+       ${CC} ${CFLAGS} -o $@ $^
+
+process_test_gen.o: process_test_gen.c process_test.h
+
 process_test_run: process_test_run.o process.o core.o swap.o block_pool.o pool.o
        ${CC} ${CFLAGS} -o $@ $^
 
index a0a6ff0..bea907a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 echo "generate test script"
-../process_test_gen 16 248 1024 32 >process_test.txt
+./process_test_gen 16 248 1024 32 >process_test.txt
 
 echo "run test script"
 ./process_test_run 16 64 192 8 384 <process_test.txt
index 8c1770f..47ea5eb 100644 (file)
@@ -1,5 +1,12 @@
 CFLAGS=-g -Wall
 
+all: process_test_gen process_test_run
+
+process_test_gen: process_test_gen.o
+       ${CC} ${CFLAGS} -o $@ $^
+
+process_test_gen.o: process_test_gen.c process_test.h
+
 process_test_run: process_test_run.o process.o core.o fuzix_fs.o util.o pool.o
        ${CC} ${CFLAGS} -o $@ $^
 
index b356aee..fee23ce 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 echo "generate test script"
-../process_test_gen 16 248 1024 32 >process_test.txt
+./process_test_gen 16 248 1024 32 >process_test.txt
 
 echo "run test script"
 rm -f fs.bin
index 56ff7c8..248f2e5 100644 (file)
@@ -1,5 +1,12 @@
 CFLAGS=-g -Wall
 
+all: process_test_gen process_test_run
+
+process_test_gen: process_test_gen.o
+       ${CC} ${CFLAGS} -o $@ $^
+
+process_test_gen.o: process_test_gen.c process_test.h
+
 process_test_run: process_test_run.o process.o core.o swap.o pool.o
        ${CC} ${CFLAGS} -o $@ $^
 
index a0a6ff0..bea907a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 echo "generate test script"
-../process_test_gen 16 248 1024 32 >process_test.txt
+./process_test_gen 16 248 1024 32 >process_test.txt
 
 echo "run test script"
 ./process_test_run 16 64 192 8 384 <process_test.txt
index 14d17a5..ea3baaa 100644 (file)
@@ -2,6 +2,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef __FUZIX__
+#include <unistd.h>
+#endif
+#include "process_test.h"
 #include "rassert.h"
 
 #ifdef __FUZIX__
@@ -40,47 +44,77 @@ int main(int argc, char **argv) {
   srand(seed);
   int pool_used = 0;
   for (int i = 0; i < n_events; ++i) {
-    int process = rand_int(n_processes);
-    long old_size = processes[process];
-    if (old_size == -1L) {
-      long size = rand_long(process_size + 1);
-      int blocks = (int)((size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
-      bool success = pool_used + blocks <= pool_blocks;
+    struct process_test test;
+#ifdef __FUZIX__
+    memset(&test, 0, sizeof(test));
+#endif
+
+    test.process = rand_int(n_processes);
+    test.old_size = processes[test.process];
+    if (test.old_size == -1L) {
+      test.size = rand_long(process_size + 1);
+      int blocks = (int)((test.size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
+      test.success = pool_used + blocks <= pool_blocks;
+
+#ifdef __FUZIX__
+      test.type = PROCESS_TEST_TYPE_ALLOC;
+      write(1, &test, sizeof(test));
+#else
       printf(
         "alloc %d %ld %s\n",
-        process,
-        size,
-        success ? "true" : "false"
+        test.process,
+        test.size,
+        test.success ? "true" : "false"
       );
-      if (success) {
-        processes[process] = size;
+#endif
+
+      if (test.success) {
+        processes[test.process] = test.size;
         pool_used += blocks;
       }
     }
     else {
-      int old_blocks = (int)((old_size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
+      int old_blocks = (int)((test.old_size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
       if (rand_int(64)) {
-        printf("run %d\n", process);
+#ifdef __FUZIX__
+        test.type = PROCESS_TEST_TYPE_RUN;
+        write(1, &test, sizeof(test));
+#else
+        printf("run %d\n", test.process);
+#endif
+
         if (rand_int(8) == 0) {
-          long size = rand_long(process_size + 1);
-          int blocks = (int)((size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
-          bool success = pool_used + blocks - old_blocks <= pool_blocks;
+          test.size = rand_long(process_size + 1);
+          int blocks = (int)((test.size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
+          test.success = pool_used + blocks - old_blocks <= pool_blocks;
+
+#ifdef __FUZIX__
+          test.type = PROCESS_TEST_TYPE_REALLOC;
+          write(1, &test, sizeof(test));
+#else
           printf(
             "realloc %d %ld %ld %s\n",
-            process,
-            old_size,
-            size,
-            success ? "true" : "false"
+            test.process,
+            test.old_size,
+            test.size,
+            test.success ? "true" : "false"
           );
-          if (success) {
-            processes[process] = size;
+#endif
+
+          if (test.success) {
+            processes[test.process] = test.size;
             pool_used += blocks - old_blocks;
           }
         }
       }
       else {
-        printf("free %d %ld\n", process, old_size);
-        processes[process] = -1;
+#ifdef __FUZIX__
+        test.type = PROCESS_TEST_TYPE_FREE;
+        write(1, &test, sizeof(test));
+#else
+        printf("free %d %ld\n", test.process, test.old_size);
+#endif
+        processes[test.process] = -1;
         pool_used -= old_blocks;
       }
     }
index 712a44a..228261b 100644 (file)
@@ -3,8 +3,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef __FUZIX__
+#include <unistd.h>
+#endif
 #include "core.h"
 #include "process.h"
+#include "process_test.h"
 #include "rassert.h"
 
 #ifdef INODE_SWAP
@@ -292,10 +296,12 @@ int main(int argc, char **argv) {
 #else
   int i, j;
 #endif
+  struct process_test test;
+#ifndef __FUZIX__
   char buf[256];
-  int process;
-  bool success, result;
-  long old_size, size, actual_old_size;
+#endif
+  bool result;
+  long actual_old_size;
   int old_blocks, blocks, actual_old_blocks;
   int swap_base, swap_blocks;
   long swap_size;
@@ -370,6 +376,10 @@ int main(int argc, char **argv) {
 
   while (true) {
  //printf("avail %d %d(%d) %d(%d)\n", process_avail, CORE_AVAIL, core_table.avail, SWAP_AVAIL, swap_table.avail);
+#ifdef __FUZIX__
+    if (read(0, &test, sizeof(test)) != sizeof(test))
+      break;
+#else
     switch ((unsigned int)scanf("%s", buf)) { // cast because of ACK bug
     case -1:
       goto done;
@@ -379,85 +389,121 @@ int main(int argc, char **argv) {
       rassert(false);
     }
     if (strcmp(buf, "alloc") == 0) {
-      rassert(scanf("%d %ld %s", &process, &size, buf) == 3);
-      rassert(process >= 0 && process < n_processes);
-      rassert(size >= 0);
+      test.type = PROCESS_TEST_TYPE_ALLOC;
+      rassert(
+        scanf(
+          "%d %ld %s",
+          &test.process,
+          &test.size,
+          buf
+        ) == 3
+      );
+      rassert(test.process >= 0 && test.process < n_processes);
+      rassert(test.size >= 0);
       if (strcmp(buf, "false") == 0)
-        success = false;
+        test.success = false;
       else if (strcmp(buf, "true") == 0)
-        success = true;
+        test.success = true;
       else
         rassert(false);
+    }
+    else if (strcmp(buf, "realloc") == 0) {
+      test.type = PROCESS_TEST_TYPE_REALLOC;
+      rassert(
+        scanf(
+          "%d %ld %ld %s",
+          &test.process,
+          &test.old_size,
+          &test.size,
+          buf
+        ) == 4
+      );
+      rassert(test.process >= 0 && test.process < n_processes);
+      rassert(test.old_size >= 0);
+      rassert(test.size >= 0);
+      if (strcmp(buf, "false") == 0)
+        test.success = false;
+      else if (strcmp(buf, "true") == 0)
+        test.success = true;
+      else
+        rassert(false);
+    }
+    else if (strcmp(buf, "run") == 0) {
+      test.type = PROCESS_TEST_TYPE_RUN;
+      rassert(scanf("%d", &test.process) == 1);
+      rassert(test.process >= 0 && test.process < n_processes);
+    } 
+    else if (strcmp(buf, "free") == 0) {
+      test.type = PROCESS_TEST_TYPE_FREE;
+      rassert(scanf("%d %ld", &test.process, &test.old_size) == 2);
+      rassert(test.process >= 0 && test.process < n_processes);
+      rassert(test.old_size >= 0);
+    }
+    else
+      rassert(false);
+#endif
+    switch (test.type) {
+    case PROCESS_TEST_TYPE_ALLOC:
       printf(
         "alloc %d %ld %s\n",
-        process,
-        size,
-        success ? "true" : "false"
+        test.process,
+        test.size,
+        test.success ? "true" : "false"
       );
-      rassert(processes[process].size == -1L);
-      result = process_alloc(processes + process, size);
+      rassert(processes[test.process].size == -1L);
+      result = process_alloc(processes + test.process, test.size);
       printf(
         "... %s\n",
-        result == success ?
+        result == test.success ?
           "ok" :
           result ? "succeeded, should fail" : "failed, should succeed"
       );
       if (result) {
-        if (!success) {
+        if (!test.success) {
           printf("... undo\n");
-          process_free(processes + process);
-          processes[process].size = -1L;
+          process_free(processes + test.process);
+          processes[test.process].size = -1L;
         }
         else {
-          core_base = processes[process].core_item.base;
-          blocks = (int)((size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
+          core_base = processes[test.process].core_item.base;
+          blocks = (int)((test.size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
           assert(
-            processes[process].core_item.limit ==
+            processes[test.process].core_item.limit ==
               core_base + blocks
           );
  //printf("new core [%d,%d)\n", core_base, core_base + blocks);
           core_hash_init(
-            process,
+            test.process,
             (long)core_base << BLOCK_SHIFT,
-            size,
+            test.size,
             0L
           );
 #ifdef PREALLOCATE_SWAP
- //printf("new swap [%d,%d)\n", processes[process].swap_item.base, processes[process].swap_item.limit);
+ //printf("new swap [%d,%d)\n", processes[test.process].swap_item.base, processes[test.process].swap_item.limit);
 #endif
         }
       }
-    }
-    else if (strcmp(buf, "realloc") == 0) {
-      rassert(scanf("%d %ld %ld %s", &process, &old_size, &size, buf) == 4);
-      rassert(process >= 0 && process < n_processes);
-      rassert(old_size >= 0);
-      rassert(size >= 0);
-      if (strcmp(buf, "false") == 0)
-        success = false;
-      else if (strcmp(buf, "true") == 0)
-        success = true;
-      else
-        rassert(false);
+      break;
+    case PROCESS_TEST_TYPE_REALLOC:
       printf(
         "realloc %d %ld %ld %s\n",
-        process,
-        old_size,
-        size,
-        success ? "true" : "false"
+        test.process,
+        test.old_size,
+        test.size,
+        test.success ? "true" : "false"
       );
-      if (processes[process].size == -1L)
+      if (processes[test.process].size == -1L)
         printf("... not allocated, ignore\n");
       else {
-        core_base = processes[process].core_item.base;
-        actual_old_size = processes[process].size;
+        core_base = processes[test.process].core_item.base;
+        actual_old_size = processes[test.process].size;
         actual_old_blocks =
           (int)((actual_old_size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
         rassert(
-          processes[process].core_item.limit ==
+          processes[test.process].core_item.limit ==
             core_base + actual_old_blocks
         );
-        old_blocks = (int)((old_size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
+        old_blocks = (int)((test.old_size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
         if (actual_old_blocks != old_blocks) {
           printf(
             "... old blocks %d, should be %d\n",
@@ -467,73 +513,68 @@ int main(int argc, char **argv) {
           rassert(actual_old_blocks <= old_blocks);
         }
 #ifdef PREALLOCATE_SWAP
- //printf("old core [%d,%d) swap [%d,%d)\n", core_base, core_base + actual_old_blocks, processes[process].swap_item.base, processes[process].swap_item.limit);
+ //printf("old core [%d,%d) swap [%d,%d)\n", core_base, core_base + actual_old_blocks, processes[test.process].swap_item.base, processes[test.process].swap_item.limit);
 #else
  //printf("old core [%d,%d)\n", core_base, core_base + actual_old_blocks);
 #endif
         core_hash_verify(
-          process,
-          ((long)core_base << BLOCK_SHIFT) + size,
-          actual_old_size - size,
-          size
+          test.process,
+          ((long)core_base << BLOCK_SHIFT) + test.size,
+          actual_old_size - test.size,
+          test.size
         );
-        result = process_realloc(processes + process, size);
+        result = process_realloc(processes + test.process, test.size);
         printf(
           "... %s\n",
-          result == success ?
+          result == test.success ?
             "ok" :
             result ? "succeeded, should fail" : "failed, should succeed"
         );
         if (result) {
-          if (!success) {
+          if (!test.success) {
             printf("... undo\n");
-            rassert(process_realloc(processes + process, actual_old_size));
+            rassert(process_realloc(processes + test.process, actual_old_size));
           }
           else {
-            core_base = processes[process].core_item.base;
-            blocks = (int)((size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
+            core_base = processes[test.process].core_item.base;
+            blocks = (int)((test.size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
             rassert(
-              processes[process].core_item.limit ==
+              processes[test.process].core_item.limit ==
                 core_base + blocks
             );
 #ifdef PREALLOCATE_SWAP
- //printf("new core [%d,%d) swap [%d,%d)\n", core_base, core_base + blocks, processes[process].swap_item.base, processes[process].swap_item.limit);
+ //printf("new core [%d,%d) swap [%d,%d)\n", core_base, core_base + blocks, processes[test.process].swap_item.base, processes[test.process].swap_item.limit);
 #else
  //printf("new core [%d,%d)\n", core_base, core_base + blocks);
 #endif
             core_hash_init(
-              process,
+              test.process,
               ((long)core_base << BLOCK_SHIFT) + actual_old_size,
-              size - actual_old_size,
+              test.size - actual_old_size,
               actual_old_size
             );
           }
         }
       }
-    }
-    else if (strcmp(buf, "run") == 0) {
-      rassert(scanf("%d", &process) == 1);
-      rassert(process >= 0 && process < n_processes);
-      printf("run %d\n", process);
-      if (processes[process].size == -1L)
+      break;
+    case PROCESS_TEST_TYPE_RUN:
+      printf("run %d\n", test.process);
+      if (processes[test.process].size == -1L)
         printf("... not allocated, ignore\n");
       else {
-        process_run(processes + process);
+        process_run(processes + test.process);
         printf("... ok\n");
       }
-    } 
-    else if (strcmp(buf, "free") == 0) {
-      rassert(scanf("%d %ld", &process, &old_size) == 2);
-      rassert(process >= 0 && process < n_processes);
-      rassert(old_size >= 0);
-      printf("free %d %ld\n", process, old_size);
-      if (processes[process].size == -1L)
+      break;
+    case PROCESS_TEST_TYPE_FREE:
+      printf("free %d %ld\n", test.process, test.old_size);
+      if (processes[test.process].size == -1L)
         printf("... not allocated, ignore\n");
       else {
         actual_old_blocks =
-          (int)((processes[process].size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
+          (int)((processes[test.process].size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
         old_blocks =
-          (int)((old_size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
+          (int)((test.old_size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
         if (actual_old_blocks != old_blocks) {
           printf(
             "... old blocks %d, should be %d\n",
@@ -542,22 +583,22 @@ int main(int argc, char **argv) {
           );
           rassert(actual_old_blocks <= old_blocks);
         }
-        if (processes[process].lru_item.prev != NULL) { // fully in core
-          assert(processes + process != victim);
+        if (processes[test.process].lru_item.prev != NULL) { // fully in core
+          assert(processes + test.process != victim);
           swap_base = -1;
           swap_blocks = 0;
           swap_size = 0L;
-          core_base = processes[process].core_item.base;
-          core_blocks = processes[process].core_item.limit - core_base;
-          core_size = processes[process].size;
+          core_base = processes[test.process].core_item.base;
+          core_blocks = processes[test.process].core_item.limit - core_base;
+          core_size = processes[test.process].size;
         }
         else {
 #ifdef INODE_SWAP
           swap_base = 0;
-          swap_size = (long)processes[process].swap_inode->c_node.i_size;
+          swap_size = (long)processes[test.process].swap_inode->c_node.i_size;
           swap_blocks = (int)((swap_size + (BLOCK_SIZE - 1)) >> BLOCK_SHIFT);
 #endif
-          if (processes + process == victim) { // victim
+          if (processes + test.process == victim) { // victim
 #ifndef INODE_SWAP
             swap_base = victim->swap_item.base;
 #ifdef PREALLOCATE_SWAP
@@ -578,9 +619,9 @@ int main(int argc, char **argv) {
           }
           else { // fully in swap
 #ifndef INODE_SWAP
-            swap_base = processes[process].swap_item.base;
-            swap_blocks = processes[process].swap_item.limit - swap_base;
-            swap_size = processes[process].size;
+            swap_base = processes[test.process].swap_item.base;
+            swap_blocks = processes[test.process].swap_item.limit - swap_base;
+            swap_size = processes[test.process].size;
 #endif
             core_base = -1;
             core_blocks = 0;
@@ -591,30 +632,31 @@ int main(int argc, char **argv) {
  //printf("old core [%d,%d) swap [%d,%d)\n", core_base, core_base + core_blocks, swap_base, swap_base + swap_blocks);
  fflush(stdout);
         core_hash_verify(
-          process,
+          test.process,
           (long)core_base << BLOCK_SHIFT,
           core_size,
           swap_size
         );
         swap_hash_verify(
-          process,
+          test.process,
 #ifdef INODE_SWAP
-          processes[process].swap_inode
+          processes[test.process].swap_inode
 #else
           (long)swap_base << BLOCK_SHIFT,
           swap_size
 #endif
         );
-        process_free(processes + process);
-        processes[process].size = -1L;
+        process_free(processes + test.process);
+        processes[test.process].size = -1L;
         printf("... ok\n");
       }
+      break;
     }
-    else
-      rassert(false);
   }
 
+#ifndef __FUZIX__
 done:
+#endif
   printf("final state:\n");
   for (i = 0; i < n_processes; ++i) {
     if (processes[i].size == -1L)