92 lines
1.8 KiB
Markdown
92 lines
1.8 KiB
Markdown
# Brief testing guide
|
|
|
|
## 1. Build and start
|
|
|
|
```bash
|
|
make
|
|
make run
|
|
```
|
|
|
|
`make run` starts the program with `disk.img` as the virtual carrier file.
|
|
|
|
## 2. Basic filesystem scenario
|
|
|
|
When testing manually in a terminal, try the **Up** and **Down** arrows after a few commands: they browse command history.
|
|
|
|
Enter these commands inside the program:
|
|
|
|
```text
|
|
format 512
|
|
mkdir /docs
|
|
touch /docs/test.txt
|
|
write /docs/test.txt hello filesystem
|
|
cp /docs/test.txt /docs/copy.txt
|
|
ls /docs
|
|
cat /docs/test.txt
|
|
mv /docs/test.txt /docs/renamed.txt
|
|
cat /docs/renamed.txt
|
|
info
|
|
```
|
|
|
|
Expected result:
|
|
|
|
- formatting succeeds;
|
|
- `/docs` contains the original file and its copy;
|
|
- `cat` prints `hello filesystem`;
|
|
- after `mv`, the file is available as `renamed.txt`;
|
|
- `info` shows a 512 KiB carrier and occupied clusters.
|
|
|
|
## 3. Compression and defragmentation
|
|
|
|
```text
|
|
touch /docs/repeat.txt
|
|
write /docs/repeat.txt aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
compress /docs/repeat.txt
|
|
ls /docs
|
|
rawcat /docs/repeat.txt
|
|
decomp /docs/repeat.txt
|
|
rawcat /docs/repeat.txt
|
|
defrag
|
|
cat /docs/repeat.txt
|
|
```
|
|
|
|
Expected result:
|
|
|
|
- `compress` succeeds for repeated text;
|
|
- in `ls`, `stored` is smaller than `size` for `repeat.txt`;
|
|
- `rawcat` shows compact RLE pairs before decompression and direct bytes after `decomp`;
|
|
- after `defrag`, the file still reads correctly.
|
|
|
|
## 4. Import and export
|
|
|
|
Before starting the program, create a host file:
|
|
|
|
```bash
|
|
echo "outside file" > host.txt
|
|
```
|
|
|
|
Then inside the program:
|
|
|
|
```text
|
|
import host.txt /docs/imported.txt
|
|
cat /docs/imported.txt
|
|
export /docs/imported.txt exported.txt
|
|
```
|
|
|
|
After leaving the program, verify:
|
|
|
|
```bash
|
|
cat exported.txt
|
|
```
|
|
|
|
Expected result: `exported.txt` contains `outside file`.
|
|
|
|
## 5. Cleanup
|
|
|
|
```bash
|
|
make clean
|
|
rm -f host.txt exported.txt
|
|
```
|
|
|
|
`make clean` removes the executable and the default virtual disk image.
|