consolidate simple tests, bug revealed
This commit is contained in:
parent
cda022e6f0
commit
9d1c59b65d
|
@ -10,6 +10,7 @@ random := @use("random.hb")
|
||||||
file := @use("file_io.hb")
|
file := @use("file_io.hb")
|
||||||
dt := @use("dt.hb")
|
dt := @use("dt.hb")
|
||||||
process := @use("process.hb")
|
process := @use("process.hb")
|
||||||
|
sleep := @use("sleep.hb")
|
||||||
|
|
||||||
panic := fn(message: ?^u8): never {
|
panic := fn(message: ?^u8): never {
|
||||||
log.error("Error: Panic Called, Message:\0")
|
log.error("Error: Panic Called, Message:\0")
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
# alloc_test
|
|
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "alloc_test"
|
|
||||||
authors = [""]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
hblang.version = "1.0.0"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
command = "hblang src/main.hb"
|
|
|
@ -1 +0,0 @@
|
||||||
# dt_buffer_test
|
|
|
@ -1,13 +0,0 @@
|
||||||
.{dt} := @use("../../../libraries/stn/src/lib.hb")
|
|
||||||
|
|
||||||
main := fn(): void {
|
|
||||||
dt.get(void, "framebuffer/fb0/width\0")
|
|
||||||
dt.get(void, "cpu/cpu0/architecture\0")
|
|
||||||
|
|
||||||
// Checking if the first detected serial port is memory mapped or port mapped
|
|
||||||
// 0 -> memory mapped
|
|
||||||
// 1 -> port mapped
|
|
||||||
dt.get(void, "serial_ports/sp0/mapping\0")
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "hash_test"
|
|
||||||
authors = [""]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
hblang.version = "1.0.0"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
command = "hblang src/main.hb"
|
|
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "processes"
|
|
||||||
authors = ["koniifer"]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
hblang.version = "1.0.0"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
command = "hblang src/main.hb"
|
|
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "serial_driver_test"
|
|
||||||
authors = ["able"]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
hblang.version = "1.0.0"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
command = "hblang src/main.hb"
|
|
|
@ -1,20 +0,0 @@
|
||||||
.{string, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
|
||||||
|
|
||||||
log_info := fn(): void {
|
|
||||||
a := buffer.search("XNumber\0")
|
|
||||||
if a == 0 {
|
|
||||||
} else {
|
|
||||||
msg := "XABC\0"
|
|
||||||
// inline is broked
|
|
||||||
// msg_length := @inline(string.length, msg)
|
|
||||||
msg_length := 5
|
|
||||||
@as(void, @eca(3, a, msg, msg_length))
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
main := fn(): int {
|
|
||||||
log_info()
|
|
||||||
return 0
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "dt_buffer_test"
|
name = "test"
|
||||||
authors = ["able"]
|
authors = ["koniifer", "able"]
|
||||||
|
|
||||||
[dependants.libraries]
|
[dependants.libraries]
|
||||||
|
|
7
sysdata/programs/test/src/main.hb
Normal file
7
sysdata/programs/test/src/main.hb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
stn := @use("./tests/stn/lib.hb")
|
||||||
|
serial_driver := @use("./tests/serial_driver.hb")
|
||||||
|
|
||||||
|
main := fn(): uint {
|
||||||
|
// return serial_driver.test()
|
||||||
|
return stn.process.test()
|
||||||
|
}
|
18
sysdata/programs/test/src/tests/serial_driver.hb
Normal file
18
sysdata/programs/test/src/tests/serial_driver.hb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
.{string, buffer} := @use("../../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
|
log_info := fn(): void {
|
||||||
|
a := buffer.search("XNumber\0")
|
||||||
|
if a == 0 {
|
||||||
|
} else {
|
||||||
|
msg := "XABC\0"
|
||||||
|
msg_length := string.length(msg)
|
||||||
|
@eca(3, a, msg, msg_length)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
test := fn(): uint {
|
||||||
|
log_info()
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
stn := @use("../../../libraries/stn/src/lib.hb");
|
stn := @use("../../../../../libraries/stn/src/lib.hb");
|
||||||
.{allocators, panic, log} := stn
|
.{allocators, panic, log} := stn
|
||||||
|
|
||||||
AStruct := struct {
|
AStruct := struct {
|
||||||
a_field: u8,
|
a_field: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
main := fn(): void {
|
test := fn(): uint {
|
||||||
// alloc := allocators.FakeAlloc.init()
|
// alloc := allocators.FakeAlloc.init()
|
||||||
// astruct := alloc.alloc(AStruct, 2)
|
// astruct := alloc.alloc(AStruct, 2)
|
||||||
// if astruct.ptr != null{
|
// if astruct.ptr != null{
|
||||||
|
@ -26,5 +26,5 @@ main := fn(): void {
|
||||||
// log.info("Allocator functioned.\0")
|
// log.info("Allocator functioned.\0")
|
||||||
// }
|
// }
|
||||||
// balloc.dealloc(bstruct_ptr, AStruct, 2)
|
// balloc.dealloc(bstruct_ptr, AStruct, 2)
|
||||||
return
|
return 0
|
||||||
}
|
}
|
18
sysdata/programs/test/src/tests/stn/dt.hb
Normal file
18
sysdata/programs/test/src/tests/stn/dt.hb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
.{dt, memory, string, log} := @use("../../../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
|
test := fn(): uint {
|
||||||
|
buffer := memory.request_page(1)
|
||||||
|
|
||||||
|
log.info(string.display_int(dt.get(int, "framebuffer/fb0/width\0"), buffer, 10))
|
||||||
|
string.clear(buffer)
|
||||||
|
|
||||||
|
log.info(string.display_int(dt.get(int, "cpu/cpu0/architecture\0"), buffer, 10))
|
||||||
|
string.clear(buffer)
|
||||||
|
|
||||||
|
// 0 -> memory mapped
|
||||||
|
// 1 -> port mapped
|
||||||
|
|
||||||
|
log.info(string.display_int(dt.get(int, "serial_ports/sp0/mapping\0"), buffer, 10))
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
.{hashers, log, memory, string} := @use("../../../libraries/stn/src/lib.hb")
|
.{hashers, log, memory, string} := @use("../../../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
main := fn(): void {
|
test := fn(): uint {
|
||||||
buffer := memory.request_page(1)
|
buffer := memory.request_page(1)
|
||||||
target := "abcdefghijklmnop\0"
|
target := "abcdefghijklmnop\0"
|
||||||
strings := [^u8].("abcdefshijklmnop\0", "abcdefghijklnnop\0", "abcdefshijklmnop\0", "abcdefghijklmnop\0", "abcdefghijflmnop\0", "dbcdefghijklmnop\0", "abcdefghijklmnop\0")
|
strings := [^u8].("abcdefshijklmnop\0", "abcdefghijklnnop\0", "abcdefshijklmnop\0", "abcdefghijklmnop\0", "abcdefghijflmnop\0", "dbcdefghijklmnop\0", "abcdefghijklmnop\0")
|
||||||
|
@ -28,4 +28,5 @@ main := fn(): void {
|
||||||
log.debug(string.display_int(@bitcast(d), buffer, 16))
|
log.debug(string.display_int(@bitcast(d), buffer, 16))
|
||||||
string.clear(buffer)
|
string.clear(buffer)
|
||||||
}
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
5
sysdata/programs/test/src/tests/stn/lib.hb
Normal file
5
sysdata/programs/test/src/tests/stn/lib.hb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
hashers := @use("./hashers.hb")
|
||||||
|
allocators := @use("./allocators.hb")
|
||||||
|
sleep := @use("./sleep.hb")
|
||||||
|
dt := @use("./dt.hb")
|
||||||
|
process := @use("./process.hb")
|
|
@ -1,8 +1,8 @@
|
||||||
.{process, log, string, memory} := @use("../../../libraries/stn/src/lib.hb")
|
.{process, log, string, memory} := @use("../../../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
exe := @embed("./hello_world_and_spin.hbf")
|
exe := @embed("./assets/hello_world_and_spin.hbf")
|
||||||
|
|
||||||
main := fn(): void {
|
test := fn(): uint {
|
||||||
buf := "\0\0\0\0\0\0\0"
|
buf := "\0\0\0\0\0\0\0"
|
||||||
loop {
|
loop {
|
||||||
log.info(
|
log.info(
|
||||||
|
@ -16,4 +16,5 @@ main := fn(): void {
|
||||||
i := 0
|
i := 0
|
||||||
loop if i == 1000000 break else i += 1
|
loop if i == 1000000 break else i += 1
|
||||||
}
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
8
sysdata/programs/test/src/tests/stn/sleep.hb
Normal file
8
sysdata/programs/test/src/tests/stn/sleep.hb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
.{sleep, log} := @use("../../../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
|
test := fn(): uint {
|
||||||
|
log.info("BEFORE\0")
|
||||||
|
sleep.sleep_until_interrupt(32)
|
||||||
|
log.info("AFTER\0")
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "timer_test"
|
|
||||||
authors = ["Talha Qamar"]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
hblang.version = "1.0.0"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
command = "hblang src/main.hb"
|
|
|
@ -1,8 +0,0 @@
|
||||||
sleep := @use("../../../libraries/stn/src/sleep.hb")
|
|
||||||
log := @use("../../../libraries/stn/src/log.hb")
|
|
||||||
|
|
||||||
main := fn(): void {
|
|
||||||
log.info("BEFORE\0")
|
|
||||||
sleep.sleep_until_interrupt(32)
|
|
||||||
log.info("AFTER\0")
|
|
||||||
}
|
|
|
@ -34,9 +34,6 @@ resolution = "1024x768x24"
|
||||||
# [boot.limine.ableos.modules.ps2_keyboard_driver]
|
# [boot.limine.ableos.modules.ps2_keyboard_driver]
|
||||||
# path = "boot:///ps2_keyboard_driver.hbf"
|
# path = "boot:///ps2_keyboard_driver.hbf"
|
||||||
|
|
||||||
[boot.limine.ableos.modules.timer_test]
|
|
||||||
path = "boot:///timer_test.hbf"
|
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.sunset_client]
|
# [boot.limine.ableos.modules.sunset_client]
|
||||||
# path = "boot:///sunset_client.hbf"
|
# path = "boot:///sunset_client.hbf"
|
||||||
#
|
#
|
||||||
|
@ -52,8 +49,5 @@ path = "boot:///timer_test.hbf"
|
||||||
# [boot.limine.ableos.modules.pcspkr]
|
# [boot.limine.ableos.modules.pcspkr]
|
||||||
# path = "boot:///pcspkr.hbf"
|
# path = "boot:///pcspkr.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.alloc_test]
|
[boot.limine.ableos.modules.test]
|
||||||
# path = "boot:///alloc_test.hbf"
|
path = "boot:///test.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.hash_test]
|
|
||||||
# path = "boot:///hash_test.hbf"
|
|
||||||
|
|
Loading…
Reference in a new issue