aboutsummaryrefslogtreecommitdiff
path: root/tests/posix.test
blob: bb9d132fc49fd461e292168b727f422b0ca2645b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
source [file dirname [info script]]/testing.tcl

needs constraint jim
constraint cmd os.getids
constraint cmd os.gethostname
constraint cmd os.uptime
constraint cmd 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