Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
daec8705
Commit
daec8705
authored
Mar 17, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
47654fc9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
19 deletions
+39
-19
t/qemu-runlinux
t/qemu-runlinux
+36
-4
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+3
-15
No files found.
t/qemu-runlinux
View file @
daec8705
...
...
@@ -32,7 +32,12 @@
# pid=1: we are running inside booted kernel as init.
# mount /sys /proc etc and tail to the program.
if
[
$$
==
1
]
;
then
echo
"qinit ..."
qinfo
()
{
test
"
$qrun_loglevel
"
-le
6
&&
return
# <= KERN_INFO
echo
"
$*
"
}
qinfo
"qinit ..."
qshutdown
()
{
echo
1
>
/proc/sys/kernel/sysrq
...
...
@@ -47,11 +52,14 @@ if [ $$ == 1 ]; then
exit
1
# just in case
}
# mount proc early & set loglevel for run phase
mount
-t
proc none /proc
echo
"
$qrun_loglevel
"
>
/proc/sys/kernel/printk
mount
-t
sysfs none /sys
mount
-t
debugfs none /sys/kernel/debug
mount
-t
bpf none /sys/fs/bpf
mount
-t
fusectl none /sys/fs/fuse/connections
mount
-t
proc none /proc
mount
-t
devtmpfs none /dev
mkdir
/dev/
{
pts,mqueue,hugepages,shm
}
...
...
@@ -77,7 +85,7 @@ if [ $$ == 1 ]; then
#set -x
set
+e
setsid
"
$0
"
.qinit2
"
$@
"
<
>
/dev/ttyS0
>
&0 2>&1
# run qinit2 with argv[1:] passed to init
ech
o
"exit code:
$?
"
qinf
o
"exit code:
$?
"
qshutdown
sleep
1d
# give time to shutdown
...
...
@@ -113,17 +121,32 @@ Run linux/program under QEMU with rootfs taken from host.
Options:
-v increase verbosity
0: ERROR+ on boot/run
1: INFO+ on run
2: INFO+ on boot/run
3: DEBUG+ on boot/run
-g run with graphics
EOF
}
# by default output goes to stdout with both /dev/console and /dev/ttyS0 (where
# program is run) attached there.
verbose
=
0
nographic
=
y
while
test
$#
!=
0
do
case
"
$1
"
in
-v
)
verbose
=
$((
$verbose
+
1
))
;;
-vv
)
verbose
=
$((
$verbose
+
2
))
;;
-vvv
)
verbose
=
$((
$verbose
+
3
))
;;
-g
)
# run with graphics UI, /dev/console goes to VGA; program to /dev/ttyS0
nographic
=
;;
-h
)
...
...
@@ -145,6 +168,14 @@ test -n "$prog" || die "program not specified"
dir
=
`
pwd
`
# loglevel: default ERROR+ on boot/run
loglevel
=
4
qrun_loglevel
=
4
test
$verbose
-ge
1
&&
qrun_loglevel
=
7
# INFO+ on run
test
$verbose
-ge
2
&&
loglevel
=
7
# INFO+ on boot/run
test
$verbose
-ge
3
&&
loglevel
=
8
# DEBUG+ on boot/run
test
$loglevel
-gt
4
&&
qrun_loglevel
=
$loglevel
# may be also useful:
# -serial stdio
# -serial file:ttyS0
...
...
@@ -175,7 +206,8 @@ qemu-system-$arch \
\
-kernel
$kernel
\
-append
"ro rootfstype=9p rootflags=trans=virtio
\
${
nographic
:+console
=ttyS0
}
init="
$(
realpath
$0
)
"
\
${
nographic
:+console
=ttyS0
}
loglevel=
$loglevel
qrun_loglevel=
$qrun_loglevel
\
init="
$(
realpath
$0
)
"
\
CWD="
$dir
" HOME="
$HOME
" LANG="
$LANG
"
${
nographic
:+TERM
=
"
$TERM
"
}
PATH="
$PATH
"
\
--
$prog
\
"
wcfs/wcfs_test.py
View file @
daec8705
...
...
@@ -327,18 +327,8 @@ class tFile:
for
blk
,
data
in
enumerate
(
datav
):
t
.
assertBlk
(
blk
,
data
)
"""
# XXX hack -> access mapped page
t.f.seek(0)
data = t.f.read()
assert len(data) == len(blkv)*t.blksize
for i, blk in enumerate(blkv):
assert len(blk) <= t.blksize
blk += b'
\
0
'*(t.blksize - len(blk)) # trailing zeros
assert data[i*t.blksize:(i+1)*t.blksize] == blk, ("#blk: %d" % i)
"""
# XXX assertCache for read blocks to be 1
# all blocks must be in cache after we touched them all
t
.
assertCache
([
1
]
*
len
(
datav
))
...
...
@@ -377,9 +367,7 @@ def test_wcfs():
t
.
commit
()
t
.
wcsync
()
# sync wcfs to ZODB
print
(
t
.
stat
(
zf
))
assert
f
.
cached
()
==
[
0
,
0
,
0
]
# initially not cached
f
.
assertCache
([
0
,
0
,
0
])
# initially not cached
f
.
assertData
([
b''
,
b''
,
s
],
mtime
=
t
.
head
)
# XXX assertCache all present?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment