Skip to content

Commit 6e63f01

Browse files
committed
Added Bootloader Stage 2 Tests
1 parent aa8e974 commit 6e63f01

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

src/bootloader/stage2.asm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ global label_exit
4040
mov eax, cr0
4141
or eax, 0x00000001
4242
mov cr0, eax
43+
44+
; __TEST_INJECT_BT2__: mov eax, 0x198A65C3
45+
; __TEST_INJECT_BT2__: HLT
4346
jmp 0x08:0x0000 ; address of smart kernel init
4447

4548
label_exit:
File renamed without changes.

tests/bootloader_stage2_test.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
TEST_INJECT_WORD="__TEST_INJECT_BT2__"
4+
TEST_MAGIC_WANT="198A65C3"
5+
6+
source tests/lib.sh
7+
8+
os_test_up "${TEST_INJECT_WORD:?}" || exit -1
9+
10+
# Test
11+
set -e
12+
echo "${SCREEN_CONTENT:?}" | grep "Bootloader: Stage 2" || ( echo "Test Failed!" && exit -1 )
13+
echo "${SCREEN_CONTENT:?}" | grep "Loading GDT Table and entering protected mode" || ( echo "Test Failed!" && exit -1 )
14+
wait ${QEMU_PID:?}
15+
echo "$0 passed!!!"

tests/run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
set -e
33

44
# Execute Tests
5-
bash tests/stage1_test.sh
5+
bash tests/bootloader_stage1_test.sh
6+
bash tests/bootloader_stage2_test.sh
67

78
# Done
89
echo "All tests passed!"

0 commit comments

Comments
 (0)