source: trunk/base/src/pextlib1.0/tests/fifo.tcl @ 13465

Last change on this file since 13465 was 13465, checked in by pguyot (Paul Guyot), 15 years ago

Improved the test for fifo.

  • Property svn:eol-style set to native
File size: 773 bytes
Line 
1# Test file for Pextlib's mkfifo.
2# Requires r/w access to /tmp/
3# Syntax:
4# tclsh mkfifo.tcl <Pextlib name>
5
6proc main {pextlibname} {
7        load $pextlibname
8       
9        set fifo_path "/tmp/darwinports-pextlib-fifo"
10       
11        file delete -force $fifo_path
12
13        # Create the named pipe.
14        mkfifo $fifo_path 0700
15       
16        # Check it exists.
17        if {![file exists $fifo_path]} {
18                puts {![file exists $fifo_path]}
19                exit 1
20        }
21
22        # Check it's a fifo.
23        if {[file type $fifo_path] != "fifo"} {
24                puts {[file type $fifo_path] != "fifo"}
25                exit 1
26        }
27
28        file delete -force $fifo_path
29       
30        set fifo_path "/tmp/darwinports-pextlib-fifo-dummydir/foo"
31
32        # Test that mkfifo returns an error if the directory doesn't exist.
33        if {![catch {mkfifo $fifo_path}]} {
34                puts {![catch {mkfifo $fifo_path}]}
35                exit 1
36        }
37}
38
39main $argv
Note: See TracBrowser for help on using the repository browser.