RustForge

foundry

Foundry OS: the operating system built on the Rustbelt kernel

foundry / rootfs / scripts / selftest.sh
3756 bytes ยท raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Rustbelt shell self-test: `cargo run --features headless` runs this with
# `sh /mnt/disk0/scripts/selftest.sh` (B:/scripts/selftest.sh) and scripts/run-headless.sh checks the output.
ver
drives
pwd
cd B:
ls
ls -l notes
type B:/readme.txt
cat b:notes/todo.txt | grep -i EXT | wc -l
dir bin | wc -l
echo first line > A:/tmp/out.txt
echo second line >> /tmp/out.txt
cat < /tmp/out.txt
md /tmp/work
copy B:/notes/todo.txt /tmp/work
touch /tmp/work/empty.txt
ls -l A:/tmp/work
del /tmp/work/todo.txt /tmp/work/empty.txt /tmp/work
grep "B:" readme.txt
alias ll="ls -l"
ll A:/tmp
run --trace cat B:/notes/todo.txt
start sleep 1
jobs
wait
cd C:
ls
cat hello-link
grep "line 12345" big.txt
cp B:/notes/todo.txt C:/todo.txt
cat C:/todo.txt | grep -i ext2
md C:/made-here
echo written by Rustbelt > C:/made-here/note.txt
type C:/made-here/note.txt
ls -l C:/
cd D:
ls
cat "long file name with spaces.txt"
cp B:/notes/todo.txt D:/
cp C:/hello.txt "Copied From Ext2.txt"
cp mixedcase.txt C:/from-exfat.txt
cat C:/from-exfat.txt
md "New Folder"
echo hi from exFAT > "New Folder/Note.txt"
type "new folder/NOTE.TXT"
ls -l D:/
cd E:
ls -l
cat hello.txt
cat hello-link
cat docs/btrfs/cow.txt
wc big.txt
grep "line 119999" big.txt
cat projects/rustbelt/stage10.txt
cp docs/btrfs/cow.txt D:/cow.txt
type D:/COW.TXT | wc -l
cp docs/btrfs/chunks.txt C:/chunks.txt
cat C:/chunks.txt | wc -l
echo hi > new.txt
rm hello.txt
mkdir newdir
run evil
# Stage 11: a stack overflow hits the guard zone and is killed cleanly;
# then two CPU hogs in the background, and sysinfo shows the load per CPU.
run overflow
start spin
start spin
sysinfo
wait
# Stage 12: networking. DHCP gave us an address; ping QEMU's gateway; fetch
# from the test web server QEMU runs for 10.0.2.100 (guestfwd), and save a
# 108 KB file to D:; look up a name (only works if the host has DNS); then
# serve one request with httpd (run-headless.sh curls it through hostfwd).
ifconfig
ping -c 3 -i 200 10.0.2.2
fetch http://10.0.2.100/
wget -o D:/seq.txt http://10.0.2.100/big
cat D:/seq.txt | wc -l
host example.com
httpd -n 1 -t 20
# Stage 13: virtual drivers. The devices in /dev; random bytes from
# virtio-rng; a shell on the second console (getty -1 runs the commands
# QEMU feeds into hvc0 from a file; its output goes to another file that
# run-headless.sh checks); the tiling demo on the virtio-gpu framebuffer.
ls -l /dev
random -n 8
random -d 6 5
getty -1 /dev/hvc0
tile
tile -r
# Stage 14: processes. Every program above was started with fork + execve;
# these check the process model itself (each prints "all checks passed").
# Then a background job ended with the kill builtin (SIGTERM: 128+15).
forktest
cowtest
mmaptest
sigtest
start spin 1000
kill %1
wait
kill -l
# Stage 15: libc plumbing. Threads summing on all 4 CPUs (futex mutex,
# TLS), an epoll + poll echo server over 127.0.0.1, ptys and the line
# discipline, nonblocking I/O; each prints "all checks passed".
threads
echoserver
ptytest
nbtest
# Stage 15.1: musl prerequisites. FPU/SSE/AVX state per thread and in
# signal frames, the Linux C-string path syscalls, and rawabi: a plain
# Linux binary built by gcc with no libc at all.
fputest
pathtest
rawabi
nosuchprogram
cd Q:
cd A:/tmp
pwd
# ---- Foundry OS ----
# Foundry OS's own programs (milestone M2): C on musl, built by
# toolchain/foundry-cc as static-PIEs. hello-musl prints one line; fprobe
# checks the C library's view of the kernel (files, processes, signals,
# threads, mmap, clocks, timerfd) and prints a summary line at the end.
hello-musl
fprobe
# dash (ports/dash), a POSIX sh built the same way, runs a script of checks.
# It is /bin/dash, not /bin/sh: the kernel starts /bin/sh, which is rbsh.
dash /mnt/disk0/scripts/dash-test.sh
# ---- end Foundry OS ----
exit 0