OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [expect/] [tests/] [spawn.test] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Commands covered:  spawn
2
#
3
# This file contains a collection of tests for one or more of the Tcl
4
# built-in commands.  Sourcing this file into Tcl runs the tests and
5
# generates output for errors.  No output means no errors were found.
6
 
7
if {[string compare test [info procs test]] == 1} then {source defs}
8
 
9
log_user 0
10
 
11
#exp_internal -f /dev/ttyp5 0
12
 
13
test spawn-1.1 {basic spawn operation} {
14
        set x [catch {exp_spawn cat}]
15
        set first_spawn_id $spawn_id; # save for later test
16
        exp_close;exp_wait
17
        set x
18
} {0}
19
 
20
test spawn-1.2 {spawn cat, then simple send/expect sequence} {
21
    set cat [exp_spawn -noecho cat -u]
22
    exp_send "a\r"
23
    expect "a" {set x 1} timeout {set x 0}
24
    exp_close;exp_wait
25
    set x
26
} {1}
27
 
28
test spawn-1.3 {spawn two processes simultaneously} {
29
    exp_spawn -noecho cat; set cat $spawn_id
30
    exp_spawn -noecho cat; set cat2 $spawn_id
31
    set x [expr {0!=[string compare [exp_pid -i $cat2] [exp_pid -i $cat]]}]
32
    exp_close -i $cat;exp_wait -i $cat;exp_close -i $cat2;exp_wait -i $cat2
33
    set x
34
} {1}
35
 
36
test spawn-1.4 {spawn open file} {
37
        set x 0
38
        set y 0
39
 
40
        set file [open /tmp/[pid] w]
41
        puts $file "testing expect's spawn -open"
42
        exp_close $file
43
        set pid [exp_spawn -open [open /tmp/[pid]]]
44
        expect "testing expect's spawn -open" {set x 1}
45
        expect eof {set y 1}
46
        exec rm /tmp/[pid]
47
        exp_wait
48
        list $x $y $pid
49
} {1 1 0}
50
 
51
test spawn-1.5 {spawn with no fd leak} {
52
        exp_spawn cat
53
        set x [expr $first_spawn_id==$spawn_id]
54
        exp_close; exp_wait
55
        set x
56
} {1}
57
 
58
# looks to be some control-char problem
59
#ftest spawn-1.6 {spawn with echo} {
60
#       exp_spawn cat
61
#} {spawn cat}
62
 
63
#ftest spawn-1.7 {spawn with -noecho} {
64
#       exp_spawn -noecho cat
65
#} {}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.