Skip to content

Commit 1705884

Browse files
committed
Added tests to travis
1 parent d7e42e0 commit 1705884

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ addons:
99
update: true
1010

1111
before_install:
12-
- sudo apt-get -y install nasm
12+
- sudo bash before_install.sh
1313

14-
script: make
14+
script:
15+
- make
16+
- bash tests/run.sh

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ debug_kernel: $(kernel_core)
130130
xxd $<
131131

132132
qemu: $(image_vmdk)
133-
cpulimit -f -l 100 -- qemu-system-x86_64 -smp 1 -m 128M -hda $< $(QEMU_SHUT_FLAGS) $(QEMU_EXTRA_FLAGS)
133+
qemu-system-x86_64 -smp 1 -m 128M -hda $< $(QEMU_SHUT_FLAGS) $(QEMU_EXTRA_FLAGS)
134134

135135
qemu_debug: $(image_vmdk)
136136
qemu-system-x86_64 -smp 1 -m 128M -hda $< $(QEMU_SHUT_FLAGS) -d cpu,exec,in_asm

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Experimental OS
66
#### Prerequisite
77

88
```
9-
sudo apt install make nasm gcc cpulimit qemu-system-x86
9+
bash before_install.sh
1010
```
1111

1212
#### Usage

before_install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
apt install -y make nasm gcc cpulimit qemu-system-x86 gocr

tests/lib.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ QEMU_SCREENSHOT="/tmp/qemu.ppm"
1919
###################################################
2020
function os_up() {
2121
# Turn up QEMU in background
22-
make qemu "SRC_DIR=${SRC_TEST_DIR:?}" QEMU_SHUT_FLAGS="" QEMU_EXTRA_FLAGS=" -monitor telnet:127.0.0.1:${MONITOR_PORT:?},server,nowait" &
22+
make qemu SRC_DIR="${SRC_TEST_DIR:?}" \
23+
QEMU_SHUT_FLAGS="" \
24+
QEMU_EXTRA_FLAGS="-nographic -monitor telnet:127.0.0.1:${MONITOR_PORT:?},server,nowait" &
2325
QEMU_PID=$!
2426

2527
while ! nc -z localhost ${MONITOR_PORT:?}; do
@@ -35,8 +37,12 @@ function os_up() {
3537
COMMAND_OUTPUT=""
3638
while true; do
3739
echo "Sending commands to QEMU."
38-
COMMAND_OUTPUT="$(echo -e 'screendump '${QEMU_SCREENSHOT:?}'\nprint $eax\nquit' | nc 127.0.0.1 ${MONITOR_PORT:?})"
39-
echo "$COMMAND_OUTPUT" | grep -i "$TEST_MAGIC_WANT" && echo "Magic Word Found! Continuing the test..." && break
40+
COMMAND_OUTPUT="$(echo -e 'screendump '${QEMU_SCREENSHOT:?}'\nprint $eax\nquit' | \
41+
nc 127.0.0.1 ${MONITOR_PORT:?})"
42+
echo "$COMMAND_OUTPUT" | \
43+
grep -i "$TEST_MAGIC_WANT" && \
44+
echo "Magic Word Found! Continuing the test..." && \
45+
break
4046
echo "Magic word not found! Got: $COMMAND_OUTPUT"
4147
done
4248

0 commit comments

Comments
 (0)