diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-08-24 09:54:45 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-08-24 09:54:45 +0000 |
commit | 3e09ac0c10c95bb24a08af62393b4f761e2743d0 (patch) | |
tree | 778dffa2ba8798503fc047db0feef6d65426ea22 /test/test_sink_tee_integration.rb | |
download | dtas-3e09ac0c10c95bb24a08af62393b4f761e2743d0.tar.gz |
Diffstat (limited to 'test/test_sink_tee_integration.rb')
-rw-r--r-- | test/test_sink_tee_integration.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/test_sink_tee_integration.rb b/test/test_sink_tee_integration.rb new file mode 100644 index 0000000..8c20adb --- /dev/null +++ b/test/test_sink_tee_integration.rb @@ -0,0 +1,34 @@ +# -*- encoding: binary -*- +# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> +# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +require './test/player_integration' +class TestSinkTeeIntegration < Minitest::Unit::TestCase + include PlayerIntegration + + def test_tee_integration + s = client_socket + default_sink_pid(s) + tee_pid = Tempfile.new(%w(dtas-test .pid)) + orig = Tempfile.new(%w(orig .junk)) + ajunk = Tempfile.new(%w(a .junk)) + bjunk = Tempfile.new(%w(b .junk)) + cmd = "echo $$ > #{tee_pid.path}; " \ + "cat /dev/fd/a > #{ajunk.path} & " \ + "cat /dev/fd/b > #{bjunk.path}; wait" + s.send("sink ed split active=true command='#{cmd}'", Socket::MSG_EOR) + assert_equal("OK", s.readpartial(666)) + pluck = "sox -n $SOXFMT - synth 3 pluck | tee #{orig.path}" + s.send("enq-cmd \"#{pluck}\"", Socket::MSG_EOR) + assert_equal "OK", s.readpartial(666) + + wait_files_not_empty(tee_pid) + pid = read_pid_file(tee_pid) + dethrottle_decoder(s) + wait_pid_dead(pid) + assert_equal ajunk.size, bjunk.size + assert_equal orig.size, bjunk.size + assert_equal ajunk.read, bjunk.read + bjunk.rewind + assert_equal orig.read, bjunk.read + end +end |