dtas.git  about / heads / tags
duct tape audio suite for *nix
blob 3a44e7b0baa12bc7e9b15b3a2534c5efd54ffc3f 1098 bytes (raw)
name: testtest_sink_tee_integration.rb 	 # note: path name is non-authoritative(*)

 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
29
30
31
32
 
# Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
# frozen_string_literal: true
require './test/player_integration'
class TestSinkTeeIntegration < 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.req_ok("sink ed split active=true command='#{cmd}'")
    pluck = "sox -n $SOXFMT - synth 3 pluck | tee #{orig.path}"
    s.req_ok("enq-cmd \"#{pluck}\"")

    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

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

git clone git://80x24.org/dtas.git
git clone https://80x24.org/dtas.git