OSDN Git Service

* public snapshot of sid simulator
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / testsuite / sidcomp.glue / attribbank.exp
1 set test "sid configuration"
2 sid_config_component_test "base.conf" \
3     "load [sid_find_file libglue.la] glue_component_library" \
4     "sw-glue-attribbank"
5 pass $test
6
7 set test "sid startup"
8 if [sid_start "base.conf"] then { pass $test } else { fail $test ; return }
9
10 set test "check initial attribute list"
11 set result [sid_cmd "sid::component::attribute_names $victim"]
12 if {$result == ""} then { pass $test } else { fail $test }
13
14 # prepare our copy of attribute table
15 catch {unset attr}
16 set attr(poof) peef
17 set attr("a") {a b c d}
18 set attr("hello") "goodbye\0come back"
19 set attr(012345) 67890
20 set attr(12345)  " "
21 # XXX: tcl system cannot seem to pass through empty strings!
22 # set attr(12345)  ""
23
24 set test "set testing attributes"
25 foreach name [array names attr] {
26     set value $attr($name)
27     set result [sid_cmd "sid::component::set_attribute_value $victim [list $name] [list $value]"]
28     if {$result != "ok"} then { fail $test ; return }
29 }
30 pass $test
31
32 set test "check testing attribute list"
33 sid_assert_includes_all "sid::component::attribute_names $victim" [array names attr]
34
35 set test "retrieve testing attributes"
36 foreach name [array names attr] {
37     set value $attr($name)
38     set result [sid_cmd "sid::component::attribute_value $victim [list $name]"]
39     if {$result != $value} then { fail "$test - $result vs $value"; return }
40 }
41 pass $test
42
43 set test "overwrite a few testing attributes"
44 set attr("hello") "nothing"
45 set attr(012345)  "something"
46 set attr(new)     "sushi swims"
47 foreach name {{"hello"} 012345 new} {
48     set value $attr($name)
49     set result [sid_cmd "sid::component::set_attribute_value $victim [list $name] [list $value]"]
50     if {$result != "ok"} then { fail $test ; return }
51 }
52 pass $test
53
54 set test "check testing attribute list after overwrite"
55 sid_assert_includes_all "sid::component::attribute_names $victim" [array names attr]
56
57 set test "retrieve testing attributes after overwrite"
58 foreach name [array names attr] {
59     set value $attr($name)
60     set result [sid_cmd "sid::component::attribute_value $victim [list $name]"]
61     if {$result != $value} then { fail "$test - $result vs $value"; return }
62 }
63 pass $test
64
65
66 set test "sid stop"
67 if [sid_stop] then { pass $test } else { fail $test ; return }
68
69
70 # zap temp file if tests were successful 
71 global exit_status
72 if {$exit_status == "0"} then { file delete "base.conf" }