File: smoke-test

package info (click to toggle)
ruby-serialport 1.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 532 kB
  • sloc: ansic: 1,425; ruby: 74; sh: 16; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 512 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

set -eu
exec 2>&1

cd $AUTOPKGTEST_TMP
cat > smoketest.rb <<-EOF
require 'serialport'
require 'pty'

# Create a fake terminal (master/slave pair)
master, slave = PTY.open
puts "Fake serial device: #{slave.path}"

# Now open the fake device with SerialPort
sp = SerialPort.new(slave.path, 9600, 8, 1, SerialPort::NONE)

# Test writing
sp.write("Hello SerialPort\n")

# Test reading
if (data = master.readpartial(100))
  puts "Read from fake serial: #{data.inspect}"
end

sp.close
EOF
ruby smoketest.rb