riscv-openocd-wch/jimtcl/tests/posix.test

38 lines
1.1 KiB
Plaintext

source [file dirname [info script]]/testing.tcl
needs constraint jim
testCmdConstraints os.getids os.gethostname os.uptime os.fork
test posix-1.1 {os.getids usage} -constraints os.getids -body {
os.getids blah
} -returnCodes error -result {wrong # args: should be "os.getids"}
test posix-1.2 {os.getids} -constraints os.getids -body {
set uid [exec id -u]
set d [os.getids]
if {$d(uid) != $uid} {
error "os.getids uid=$d(uid) not match system $uid"
}
} -result {}
test posix-1.4 {os.uptime} -constraints os.uptime -body {
string is integer -strict [os.uptime]
} -result {1}
test posix-1.5 {os.gethostname usage} -constraints os.gethostname -body {
os.gethostname blah
} -returnCodes error -result {wrong # args: should be "os.gethostname"}
test posix-1.6 {os.gethostname} -constraints os.gethostname -body {
if {[exec hostname] ne [os.gethostname]} {
error "os.gethostname did not match system hostname"
}
} -result {}
test posix-1.7 {os.fork usage} -constraints os.fork -body {
os.fork extra args
} -returnCodes error -result {wrong # args: should be "os.fork"}
testreport