1 # Testsuite for the socket server
3 # Copyright (C) 1999 Red Hat
5 set test "sid configuration"
6 sid_config_component_test_with_tracing "server2.conf" \
7 "load [sid_find_file libconsoles.la] console_component_library" \
12 if {[sid_start "server2.conf"]} { pass $test } else { fail $test ; return }
14 set test "find pin that does not exist"
15 set pin [sid_cmd "sid::component::find_pin $victim pin"]
16 if {$pin == ""} then { pass $test } else { fail $test }
18 set test "connect to a pin that does not exist"
19 set pin [sid_cmd "sid::pin::new"]
20 set status [sid_cmd "sid::component::connect_pin $victim input $pin"]
21 if {$status == "not_found"} then { pass $test } else { fail $test }
23 set test "check connected pins on a pin that does not exist"
24 set pin [sid_cmd "sid::component::connected_pins $victim input2"]
25 if {$pin == ""} then { pass $test } else { fail $test }
27 set test "check disconnecting pin on a pin that does not exist"
28 set pin [sid_cmd "sid::pin::new"]
29 set status [sid_cmd "sid::component::disconnect_pin $victim input $pin"]
30 if {$status == "not_found"} then { pass $test } else { fail $test }
32 set test "find bus that does not exist"
33 set pin [sid_cmd "sid::component::find_bus $victim bus"]
34 if {$pin == ""} then { pass $test } else { fail $test }
36 set test "connect to an accessor that does not exist"
37 set bus [sid_cmd "sid::bus::new"]
38 set status [sid_cmd "sid::component::connect_accessor $victim bus1 $bus"]
39 if {$status == "not_found"} then { pass $test } else { fail $test }
41 set test "check connected bus on a bus that does not exist"
42 set bus2 [sid_cmd "sid::component::connected_bus $victim bus2"]
43 if {$bus2 == ""} then { pass $test } else { fail $test }
45 set test "set relationships that does not exist"
46 set status [sid_cmd "sid::component::relate $victim any $victim"]
47 if {$status == "not_found"} then { pass $test } else { fail $test }
49 set test "set relationships to relate to a non existing component"
50 set status [sid_cmd "sid::component::relate $victim relationship $victim"]
51 if {$status == "not_found"} then { pass $test } else { fail $test }
53 set test "query relationships that does not exist"
54 set comps [sid_cmd "sid::component::related_components $victim rel"]
55 if {$comps == ""} then { pass $test } else { fail $test }
57 set test "set non existing attribute to -1"
58 set status [sid_cmd "sid::component::set_attribute_value $victim new -1" ]
59 if {$status == "not_found"} then { pass $test } else { fail $test }
61 foreach num_attr {tx-count rx-count poll-count max-poll-interval poll-interval} {
62 foreach badval {-1 "127.0.0.0:xxx" true 0.0e0 } {
63 set test "set attribute $num_attr to $badval"
64 set status [sid_cmd "sid::component::set_attribute_value $victim $num_attr $badval"]
65 if {$num_attr == "max-poll-interval" && $badval == "-1" || $num_attr == "poll-interval" && $badval == "-1"} {
66 if {$status == "ok"} then {pass $test} else { fail $test}
68 if {$status == "bad_value"} then {pass $test} else { fail $test}
73 foreach bool_attr {server? verbose? trace-traffic? buffer-while-disconnected? connected?} {
74 foreach badval {-1 "127.0.0.0:xxx" 123e5 string} {
75 set test "set attribute $bool_attr to $badval"
76 set status [sid_cmd "sid::component::set_attribute_value $victim $bool_attr $badval"]
77 if {$status == "bad_value"} then {pass $test} else { fail $test}
81 foreach addr_attr {sockaddr-local sockaddr-peer} {
82 foreach badval {-1 "127.0.0.0:xxx" 123e5 string on "a.b.c.d:e"} {
83 set test "set attribute $addr_attr to $badval"
84 set status [sid_cmd "sid::component::set_attribute_value $victim $addr_attr $badval"]
85 if {$status == "bad_value"} then {pass $test} else { fail $test}
89 foreach pin_attr {init fini tx rx} {
90 foreach badval {"127.0.0.0:111" 123e5 string on} {
91 set test "set attribute $pin_attr to $badval"
92 set status [sid_cmd "sid::component::set_attribute_value $victim $pin_attr $badval"]
93 if {$status == "bad_value"} then {pass $test} else { fail $test}
97 foreach ro_attr {tx-count tx-buffer rx-count poll-count avg-tx-buffer-size sockaddr-peer connected?} {
98 foreach badval {123 1.1 "127.0.0.1:123" yes} {
99 set test "set attribute $ro_attr to $badval"
100 set status [sid_cmd "sid::component::set_attribute_value $victim $ro_attr $badval"]
101 if {$status == "bad_value"} then {pass $test} else { fail $test}
105 set test "try driving fini pin before driving init pin"
106 set fini [sid_cmd "sid::component::find_pin $victim fini"]
107 sid_assert_success "sid::pin::driven_h4 $fini 1"
108 if {$fini != "" } then { pass $test } else { fail $test }
110 foreach value {-1 0 255 256} {
111 set test "try driving tx pin with $value when there is no connection"
112 set tx [sid_cmd "sid::component::find_pin $victim tx"]
113 sid_assert_success "sid::pin::driven_h4 $tx $value"
118 if [sid_stop] then { pass $test } else { fail $test ; return }
121 # zap temp file if tests were successful
123 if {$exit_status == "0"} then { file delete "server2.conf" }