Changeset 27071 in project


Ignore:
Timestamp:
07/18/12 15:27:17 (9 years ago)
Author:
Alex Shinn
Message:

need to include <termios.h> for struct winsize

Location:
release/4/pty
Files:
3 edited
3 copied

Legend:

Unmodified
Added
Removed
  • release/4/pty/tags/1.4/pty-test.scm

    r20027 r27071  
    11;;;; pty-test.scm
    22
    3 (use testbase testbase-output-human)
     3(use test)
    44(use pty)
    5 (use utils miscmacros)
    65
    7 (define-for-syntax test::timing #f)
    8 (define-for-syntax test::filtering #f)
    9 (define-for-syntax test::selecting #f)
    10 (define-for-syntax test::limiting #f)
     6(test-begin "pty")
    117
    12 #;(define (kill-it! pid)
    13   (process-signal pid)
    14   (process-wait pid #t) )
    15  
    16 #;(char-name 'eot (integer->char 4))
    17 
    18 (define-test pty-error-test "Pty procedure error"
    19   (expect-exception "Invalid Procedure"
    20     (property exn
    21       (message "invalid procedure")
    22       (arguments '(foo))
    23       (location 'call-with-pty-process-io))
    24     (call-with-pty-process-io "foo" 'foo))
    25 )
     8(test-error (call-with-pty-process-io "foo" 'foo))
    269
    2710;** PROBLEM **
     
    3013;Repeat runs have caused process pend on MacOS 10.4
    3114;Must be using 'bc' wrong
    32 #;(define-test pty-bc-test "Pty using 'bc'"
    33   (expect-eqv "PI"
    34     3.1415926532
    35     (call-with-pty-process-io '("/usr/bin/bc" "-lqi")
    36       (lambda (in out pid)
    37         ;operation
    38         (display "scale=10; 4*a(1)" out) (newline out)
    39         ;result
    40         (begin0
    41           (read in)
    42           #;(let loop ([lines '()])
    43             (if (char-ready? in)
    44               (loop (cons (read-line in) lines))
    45               (reverse! lines)))
    46           ;clean termination
    47           (display "quit" out) (newline out) ) )
    48       "BC"))
    49   (expect-success (gc #t))
    50 )
     15;; (test 3.1415926532
     16;;     (call-with-pty-process-io
     17;;      '("/usr/bin/bc" "-lqi")
     18;;      (lambda (in out pid)
     19;;        ;;operation
     20;;        (display "scale=10; 4*a(1)" out) (newline out)
     21;;        ;;result
     22;;        (let ((res (read in)))
     23;;          ;; clean termination
     24;;          (display "quit\n" out)
     25;;          res))))
    5126
    52 (define-test pty-units-test "Pty using 'units'"
    53   (expect-equal "Meters/Feet"
    54     '("meters" "feet" "\t* 3.2808399" "\t/ 0.3048")
    55     (call-with-pty-process-io '("/usr/bin/units" "-q")
    56       (lambda (in out pid)
    57         ;operation
    58         (display "meters" out) (newline out)
    59         (display "feet" out) (newline out)
    60         ;result
    61         (begin0
    62           (list (read-line in) (read-line in) (read-line in) (read-line in))
    63           ;clean termination - send EOT
    64           (display (integer->char 4) out) ) )
    65       "Units"))
    66   (expect-success (gc #t))
    67 )
     27(test '("meters" "feet" "\t* 3.2808399" "\t/ 0.3048")
     28    (call-with-pty-process-io
     29     '("/usr/bin/units" "-q")
     30     (lambda (in out pid)
     31       ;; operation
     32       (display "meters" out) (newline out)
     33       (display "feet" out) (newline out)
     34       ;; result
     35       (let ((res (list (read-line in) (read-line in)
     36                        (read-line in) (read-line in))))
     37         ;; clean termination - send EOT
     38         (display (integer->char 4) out)
     39         res))))
    6840
    69 (test::for-each (cut test::styler-set! <> test::output-style-human))
    70 (run-test "Pty Test")
     41(test-end)
  • release/4/pty/tags/1.4/pty.scm

    r27070 r27071  
    1717(foreign-declare "#include <fcntl.h>\n")
    1818(foreign-declare "#include <errno.h>\n")
     19(foreign-declare "#include <termios.h>\n")
    1920(foreign-declare "#include <sys/types.h>\n")
    2021(foreign-declare "#include <sys/wait.h>\n")
  • release/4/pty/trunk/pty-test.scm

    r20027 r27071  
    11;;;; pty-test.scm
    22
    3 (use testbase testbase-output-human)
     3(use test)
    44(use pty)
    5 (use utils miscmacros)
    65
    7 (define-for-syntax test::timing #f)
    8 (define-for-syntax test::filtering #f)
    9 (define-for-syntax test::selecting #f)
    10 (define-for-syntax test::limiting #f)
     6(test-begin "pty")
    117
    12 #;(define (kill-it! pid)
    13   (process-signal pid)
    14   (process-wait pid #t) )
    15  
    16 #;(char-name 'eot (integer->char 4))
    17 
    18 (define-test pty-error-test "Pty procedure error"
    19   (expect-exception "Invalid Procedure"
    20     (property exn
    21       (message "invalid procedure")
    22       (arguments '(foo))
    23       (location 'call-with-pty-process-io))
    24     (call-with-pty-process-io "foo" 'foo))
    25 )
     8(test-error (call-with-pty-process-io "foo" 'foo))
    269
    2710;** PROBLEM **
     
    3013;Repeat runs have caused process pend on MacOS 10.4
    3114;Must be using 'bc' wrong
    32 #;(define-test pty-bc-test "Pty using 'bc'"
    33   (expect-eqv "PI"
    34     3.1415926532
    35     (call-with-pty-process-io '("/usr/bin/bc" "-lqi")
    36       (lambda (in out pid)
    37         ;operation
    38         (display "scale=10; 4*a(1)" out) (newline out)
    39         ;result
    40         (begin0
    41           (read in)
    42           #;(let loop ([lines '()])
    43             (if (char-ready? in)
    44               (loop (cons (read-line in) lines))
    45               (reverse! lines)))
    46           ;clean termination
    47           (display "quit" out) (newline out) ) )
    48       "BC"))
    49   (expect-success (gc #t))
    50 )
     15;; (test 3.1415926532
     16;;     (call-with-pty-process-io
     17;;      '("/usr/bin/bc" "-lqi")
     18;;      (lambda (in out pid)
     19;;        ;;operation
     20;;        (display "scale=10; 4*a(1)" out) (newline out)
     21;;        ;;result
     22;;        (let ((res (read in)))
     23;;          ;; clean termination
     24;;          (display "quit\n" out)
     25;;          res))))
    5126
    52 (define-test pty-units-test "Pty using 'units'"
    53   (expect-equal "Meters/Feet"
    54     '("meters" "feet" "\t* 3.2808399" "\t/ 0.3048")
    55     (call-with-pty-process-io '("/usr/bin/units" "-q")
    56       (lambda (in out pid)
    57         ;operation
    58         (display "meters" out) (newline out)
    59         (display "feet" out) (newline out)
    60         ;result
    61         (begin0
    62           (list (read-line in) (read-line in) (read-line in) (read-line in))
    63           ;clean termination - send EOT
    64           (display (integer->char 4) out) ) )
    65       "Units"))
    66   (expect-success (gc #t))
    67 )
     27(test '("meters" "feet" "\t* 3.2808399" "\t/ 0.3048")
     28    (call-with-pty-process-io
     29     '("/usr/bin/units" "-q")
     30     (lambda (in out pid)
     31       ;; operation
     32       (display "meters" out) (newline out)
     33       (display "feet" out) (newline out)
     34       ;; result
     35       (let ((res (list (read-line in) (read-line in)
     36                        (read-line in) (read-line in))))
     37         ;; clean termination - send EOT
     38         (display (integer->char 4) out)
     39         res))))
    6840
    69 (test::for-each (cut test::styler-set! <> test::output-style-human))
    70 (run-test "Pty Test")
     41(test-end)
  • release/4/pty/trunk/pty.scm

    r27070 r27071  
    1717(foreign-declare "#include <fcntl.h>\n")
    1818(foreign-declare "#include <errno.h>\n")
     19(foreign-declare "#include <termios.h>\n")
    1920(foreign-declare "#include <sys/types.h>\n")
    2021(foreign-declare "#include <sys/wait.h>\n")
Note: See TracChangeset for help on using the changeset viewer.