dtas 0.15.0 → 0.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -1
  3. data/Documentation/.gitignore +1 -1
  4. data/Documentation/GNUmakefile +2 -2
  5. data/Documentation/dtas-archive.pod +2 -2
  6. data/Documentation/dtas-console.pod +2 -2
  7. data/Documentation/dtas-ctl.pod +2 -2
  8. data/Documentation/dtas-cueedit.pod +2 -2
  9. data/Documentation/dtas-enq.pod +2 -2
  10. data/Documentation/dtas-env.pod +3 -3
  11. data/Documentation/dtas-msinkctl.pod +2 -2
  12. data/Documentation/dtas-player.pod +2 -2
  13. data/Documentation/dtas-player_effects.pod +2 -2
  14. data/Documentation/dtas-player_protocol.pod +4 -4
  15. data/Documentation/dtas-player_sink_examples.pod +2 -2
  16. data/Documentation/dtas-sinkedit.pod +4 -4
  17. data/Documentation/dtas-sourceedit.pod +4 -4
  18. data/Documentation/dtas-splitfx.pod +7 -1
  19. data/Documentation/dtas-tl.pod +4 -4
  20. data/Documentation/dtas-xdelay.pod +2 -2
  21. data/Documentation/update-footer.rb +2 -2
  22. data/GIT-VERSION-GEN +2 -2
  23. data/GNUmakefile +1 -1
  24. data/HACKING +2 -2
  25. data/INSTALL +13 -24
  26. data/README +14 -8
  27. data/Rakefile +2 -2
  28. data/TODO +3 -1
  29. data/bin/dtas-archive +1 -1
  30. data/bin/dtas-console +19 -23
  31. data/bin/dtas-ctl +1 -1
  32. data/bin/dtas-cueedit +1 -1
  33. data/bin/dtas-enq +1 -1
  34. data/bin/dtas-mlib +1 -1
  35. data/bin/dtas-msinkctl +1 -1
  36. data/bin/dtas-partstats +1 -1
  37. data/bin/dtas-player +1 -1
  38. data/bin/dtas-readahead +4 -4
  39. data/bin/dtas-sinkedit +1 -1
  40. data/bin/dtas-sourceedit +1 -1
  41. data/bin/dtas-splitfx +8 -1
  42. data/bin/dtas-tl +1 -1
  43. data/bin/dtas-xdelay +1 -1
  44. data/dtas-linux.gemspec +5 -6
  45. data/dtas-mpris.gemspec +2 -2
  46. data/dtas.gemspec +2 -2
  47. data/examples/zsh-completion/README +3 -0
  48. data/examples/zsh-completion/_dtas-archive +16 -0
  49. data/examples/zsh-completion/_dtas-ctl +114 -0
  50. data/examples/zsh-completion/_dtas-cueedit +7 -0
  51. data/examples/zsh-completion/_dtas-enq +7 -0
  52. data/examples/zsh-completion/_dtas-mlib +29 -0
  53. data/examples/zsh-completion/_dtas-msinkctl +8 -0
  54. data/examples/zsh-completion/_dtas-partstats +7 -0
  55. data/examples/zsh-completion/_dtas-sinkedit +11 -0
  56. data/examples/zsh-completion/_dtas-sourceedit +11 -0
  57. data/examples/zsh-completion/_dtas-splitfx +17 -0
  58. data/examples/zsh-completion/_dtas-tl +52 -0
  59. data/examples/zsh-completion/_dtas-xdelay +17 -0
  60. data/lib/dtas.rb +12 -2
  61. data/lib/dtas/buffer.rb +10 -5
  62. data/lib/dtas/buffer/fiddle_splice.rb +216 -0
  63. data/lib/dtas/buffer/read_write.rb +3 -3
  64. data/lib/dtas/buffer/splice.rb +16 -10
  65. data/lib/dtas/command.rb +1 -1
  66. data/lib/dtas/compat_onenine.rb +1 -1
  67. data/lib/dtas/cue_index.rb +1 -1
  68. data/lib/dtas/disclaimer.rb +1 -1
  69. data/lib/dtas/edit_client.rb +1 -1
  70. data/lib/dtas/encoding.rb +57 -0
  71. data/lib/dtas/fadefx.rb +1 -1
  72. data/lib/dtas/format.rb +1 -1
  73. data/lib/dtas/mcache.rb +1 -1
  74. data/lib/dtas/mlib.rb +38 -31
  75. data/lib/dtas/mlib/migrations/0001_initial.rb +1 -1
  76. data/lib/dtas/nonblock.rb +1 -1
  77. data/lib/dtas/parse_freq.rb +1 -1
  78. data/lib/dtas/parse_time.rb +1 -1
  79. data/lib/dtas/partstats.rb +1 -1
  80. data/lib/dtas/pipe.rb +16 -9
  81. data/lib/dtas/pipeline.rb +75 -0
  82. data/lib/dtas/player.rb +3 -3
  83. data/lib/dtas/player/client_handler.rb +23 -15
  84. data/lib/dtas/process.rb +1 -1
  85. data/lib/dtas/replaygain.rb +1 -1
  86. data/lib/dtas/rg_state.rb +1 -1
  87. data/lib/dtas/serialize.rb +1 -1
  88. data/lib/dtas/sigevent.rb +6 -3
  89. data/lib/dtas/sigevent/efd.rb +3 -1
  90. data/lib/dtas/sigevent/fiddle_efd.rb +38 -0
  91. data/lib/dtas/sigevent/pipe.rb +2 -2
  92. data/lib/dtas/sink.rb +1 -1
  93. data/lib/dtas/source.rb +1 -1
  94. data/lib/dtas/source/av.rb +1 -1
  95. data/lib/dtas/source/av_ff_common.rb +1 -1
  96. data/lib/dtas/source/cmd.rb +1 -1
  97. data/lib/dtas/source/common.rb +1 -1
  98. data/lib/dtas/source/ff.rb +1 -1
  99. data/lib/dtas/source/file.rb +1 -1
  100. data/lib/dtas/source/mp3gain.rb +1 -1
  101. data/lib/dtas/source/sox.rb +4 -2
  102. data/lib/dtas/source/splitfx.rb +1 -1
  103. data/lib/dtas/spawn_fix.rb +1 -1
  104. data/lib/dtas/splitfx.rb +6 -3
  105. data/lib/dtas/state_file.rb +1 -1
  106. data/lib/dtas/tfx.rb +1 -1
  107. data/lib/dtas/track.rb +1 -1
  108. data/lib/dtas/tracklist.rb +1 -1
  109. data/lib/dtas/unix_accepted.rb +1 -1
  110. data/lib/dtas/unix_client.rb +1 -1
  111. data/lib/dtas/unix_server.rb +1 -1
  112. data/lib/dtas/util.rb +1 -1
  113. data/lib/dtas/watchable.rb +60 -55
  114. data/lib/dtas/watchable/fiddle_ino.rb +78 -0
  115. data/lib/dtas/watchable/inotify.rb +13 -0
  116. data/lib/dtas/writable_iter.rb +1 -1
  117. data/lib/dtas/xs.rb +1 -1
  118. data/perl/dtas-graph +7 -2
  119. data/setup.rb +1 -2
  120. data/test/covshow.rb +1 -1
  121. data/test/helper.rb +1 -1
  122. data/test/player_integration.rb +1 -1
  123. data/test/test_buffer.rb +14 -10
  124. data/test/test_encoding.rb +20 -0
  125. data/test/test_env.rb +1 -1
  126. data/test/test_fadefx.rb +1 -1
  127. data/test/test_format.rb +1 -1
  128. data/test/test_format_change.rb +1 -1
  129. data/test/test_mcache.rb +1 -1
  130. data/test/test_mlib.rb +3 -3
  131. data/test/test_parse_freq.rb +1 -1
  132. data/test/test_pipeline.rb +47 -0
  133. data/test/test_player.rb +1 -1
  134. data/test/test_player_client_handler.rb +1 -1
  135. data/test/test_player_integration.rb +1 -1
  136. data/test/test_process.rb +1 -1
  137. data/test/test_rg_integration.rb +1 -1
  138. data/test/test_rg_state.rb +1 -1
  139. data/test/test_sigevent.rb +20 -0
  140. data/test/test_sink.rb +1 -1
  141. data/test/test_sink_pipe_size.rb +13 -16
  142. data/test/test_sink_tee_integration.rb +1 -1
  143. data/test/test_source_av.rb +1 -1
  144. data/test/test_source_sox.rb +1 -1
  145. data/test/test_splitfx.rb +1 -1
  146. data/test/test_tfx.rb +1 -1
  147. data/test/test_tracklist.rb +1 -1
  148. data/test/test_unixserver.rb +1 -1
  149. data/test/test_util.rb +1 -1
  150. metadata +26 -5
@@ -0,0 +1,78 @@
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
+ # frozen_string_literal: true
4
+ require 'fiddle'
5
+
6
+ # used to restart DTAS::Source::SplitFX processing in dtas-player
7
+ # if the YAML file is edited
8
+ class DTAS::Watchable::InotifyReadableIter # :nodoc:
9
+ include DTAS::Watchable::InotifyCommon
10
+
11
+ Inotify_init = Fiddle::Function.new(DTAS.libc['inotify_init1'],
12
+ [ Fiddle::TYPE_INT ],
13
+ Fiddle::TYPE_INT)
14
+
15
+ Inotify_add_watch = Fiddle::Function.new(DTAS.libc['inotify_add_watch'],
16
+ [ Fiddle::TYPE_INT, Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT ],
17
+ Fiddle::TYPE_INT)
18
+
19
+ # IO.select compatibility
20
+ attr_reader :to_io #:nodoc:
21
+
22
+ def initialize # :nodoc:
23
+ fd = Inotify_init.call(02000000 | 04000) # CLOEXEC | NONBLOCK
24
+ raise "inotify_init failed: #{Fiddle.last_error}" if fd < 0
25
+ @to_io = DTAS::Nonblock.for_fd(fd)
26
+ @buf = ''.b
27
+ @q = []
28
+ end
29
+
30
+ # struct inotify_event {
31
+ # int wd; /* Watch descriptor */
32
+ # uint32_t mask; /* Mask describing event */
33
+ # uint32_t cookie; /* Unique cookie associating related
34
+ # events (for rename(2)) */
35
+ # uint32_t len; /* Size of name field */
36
+ # char name[]; /* Optional null-terminated name */
37
+ InotifyEvent = Struct.new(:wd, :mask, :cookie, :len, :name) # :nodoc:
38
+
39
+ def take(nonblock) # :nodoc:
40
+ event = @q.pop and return event
41
+ case rv = @to_io.read_nonblock(16384, @buf, exception: false)
42
+ when :wait_readable, nil
43
+ return
44
+ else
45
+ until rv.empty?
46
+ hdr = rv.slice!(0,16)
47
+ name = nil
48
+ wd, mask, cookie, len = res = hdr.unpack('iIII')
49
+ wd && mask && cookie && len or
50
+ raise "bogus inotify_event #{res.inspect} hdr=#{hdr.inspect}"
51
+ if len > 0
52
+ name = rv.slice!(0, len)
53
+ name.size == len or raise "short name #{name.inspect} != #{len}"
54
+ name.sub!(/\0+\z/, '') or
55
+ raise "missing: `\\0', inotify_event.name=#{name.inspect}"
56
+ name = DTAS.dedupe_str(name)
57
+ end
58
+ ie = InotifyEvent.new(wd, mask, cookie, len, name)
59
+ if event
60
+ @q << ie
61
+ else
62
+ event = ie
63
+ end
64
+ end # /until rv.empty?
65
+ return event
66
+ end while true
67
+ end
68
+
69
+ def add_watch(watchdir, flags)
70
+ wd = Inotify_add_watch.call(@to_io.fileno, watchdir, flags)
71
+ raise "inotify_add_watch failed: #{Fiddle.last_error}" if wd < 0
72
+ wd
73
+ end
74
+
75
+ def close
76
+ @to_io = @to_io.close if @to_io
77
+ end
78
+ end
@@ -0,0 +1,13 @@
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
+ # frozen_string_literal: true
4
+ require 'sleepy_penguin'
5
+
6
+ # used to restart DTAS::Source::SplitFX processing in dtas-player
7
+ # if the YAML file is edited
8
+ class DTAS::Watchable::InotifyReadableIter < SleepyPenguin::Inotify # :nodoc:
9
+ include DTAS::Watchable::InotifyCommon
10
+ def self.new
11
+ super(:CLOEXEC)
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative '../dtas'
data/lib/dtas/xs.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative '../dtas'
data/perl/dtas-graph CHANGED
@@ -1,6 +1,10 @@
1
1
  #!/usr/bin/perl -w
2
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
+ #
5
+ # Process visualizer which shows pipe connections between processes with
6
+ # ASCII art. Useful for displaying complex interations between different
7
+ # processes in a non-traditional pipeline.
4
8
  use strict;
5
9
  use Graph::Easy; # for ASCII-art graphs
6
10
  $^O =~ /linux/ or print STDERR "$0 probably only works on Linux...\n";
@@ -123,7 +127,8 @@ foreach my $pid (sort { $a <=> $b } keys %pids) {
123
127
  print "\nPIPEID PIPE_INO\n";
124
128
  foreach my $pipe_id (sort { $a <=> $b } keys %graphed) {
125
129
  printf "% 6s", "|$pipe_id";
126
- print " ", $graphed{$pipe_id}, "\n";
130
+ my $ino = $graphed{$pipe_id};
131
+ printf " %u (0x%0x)\n", $ino, $ino;
127
132
  }
128
133
 
129
134
  print $graph->as_ascii;
data/setup.rb CHANGED
@@ -281,7 +281,6 @@ def multipackage_entries
281
281
  'site-ruby-common' => 'siteruby', # For backward compatibility
282
282
  'site-ruby' => 'siterubyver', # For backward compatibility
283
283
  'bin-dir' => 'bindir',
284
- 'bin-dir' => 'bindir',
285
284
  'rb-dir' => 'rbdir',
286
285
  'so-dir' => 'sodir',
287
286
  'data-dir' => 'datadir',
@@ -785,7 +784,7 @@ def ToplevelInstaller.load_rbconfig
785
784
  else
786
785
  require 'rbconfig'
787
786
  end
788
- ::Config::CONFIG
787
+ ::RbConfig::CONFIG
789
788
  end
790
789
 
791
790
  def initialize(ardir_root, config)
data/test/covshow.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  #
data/test/helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  $stdout.sync = $stderr.sync = Thread.abort_on_exception = true
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/helper'
data/test/test_buffer.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/helper'
@@ -49,14 +49,14 @@ def test_set_buffer_size
49
49
  buf = new_buffer
50
50
  buf.buffer_size = @@max_size
51
51
  assert_equal @@max_size, buf.buffer_size
52
- end if @@max_size
52
+ end if defined?(DTAS::Pipe::F_GETPIPE_SZ)
53
53
 
54
54
  def test_buffer_size
55
55
  buf = new_buffer
56
56
  assert_operator buf.buffer_size, :>, 128
57
57
  buf.buffer_size = @@max_size
58
58
  assert_equal @@max_size, buf.buffer_size
59
- end if @@max_size
59
+ end if defined?(DTAS::Pipe::F_GETPIPE_SZ)
60
60
 
61
61
  def test_broadcast_1
62
62
  buf = new_buffer
@@ -87,9 +87,9 @@ def test_broadcast_tee
87
87
  assert_empty blocked
88
88
  assert_equal "HELLO", a[0].read(5)
89
89
  assert_equal "HELLO", b[0].read(5)
90
- max = '*' * a[0].pipe_size
90
+ max = '*' * pipe_size(a[0])
91
91
  assert_equal max.size, a[1].write(max)
92
- assert_equal a[0].nread, a[0].pipe_size
92
+ assert_equal a[0].nread, pipe_size(a[0])
93
93
  a[1].nonblock = true
94
94
  assert_equal 5, buf.__broadcast_tee(blocked, [a[1], b[1]], 5)
95
95
  assert_equal [a[1]], blocked
@@ -108,10 +108,10 @@ def test_broadcast
108
108
  assert_equal "HELLO", a[0].read(5)
109
109
  assert_equal "HELLO", b[0].read(5)
110
110
 
111
- return unless b[1].respond_to?(:pipe_size)
111
+ return unless defined?(DTAS::Pipe::F_GETPIPE_SZ)
112
112
 
113
113
  b[1].nonblock = true
114
- b[1].write('*' * b[1].pipe_size)
114
+ b[1].write('*' * pipe_size(b[1]))
115
115
  buf.wr.write "BYE"
116
116
  assert_equal :wait_readable, buf.broadcast([a[1], b[1]])
117
117
  assert_equal 8, buf.bytes_xfer
@@ -157,8 +157,8 @@ def test_broadcast_all_full
157
157
  a = pipe
158
158
  b = pipe
159
159
  buf = new_buffer
160
- a[1].write('*' * a[1].pipe_size)
161
- b[1].write('*' * b[1].pipe_size)
160
+ a[1].write('*' * pipe_size(a[1]))
161
+ b[1].write('*' * pipe_size(b[1]))
162
162
 
163
163
  a[1].nonblock = true
164
164
  b[1].nonblock = true
@@ -167,7 +167,7 @@ def test_broadcast_all_full
167
167
  buf.wr.write "HELLO"
168
168
  assert_equal tmp, buf.broadcast(tmp)
169
169
  assert_equal [a[1], b[1]], tmp
170
- end if IO.method_defined?(:pipe_size)
170
+ end if defined?(DTAS::Pipe::F_GETPIPE_SZ)
171
171
 
172
172
  def test_serialize
173
173
  buf = new_buffer
@@ -204,4 +204,8 @@ def test_load_size
204
204
  assert_equal 4096, buf.buffer_size
205
205
  buf.close!
206
206
  end
207
+
208
+ def pipe_size(io)
209
+ io.fcntl(DTAS::Pipe::F_GETPIPE_SZ)
210
+ end
207
211
  end
@@ -0,0 +1,20 @@
1
+ # Copyright (C) 2018-2020 all contributors <dtas-all@nongnu.org>
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
+ # frozen_string_literal: true
4
+ require './test/helper'
5
+ require 'dtas'
6
+ require 'yaml'
7
+
8
+ class TestEncoding < Testcase
9
+ def test_encoding
10
+ data = <<EOD # <20180111114546.77906b35@cumparsita.ch>
11
+ ---
12
+ comments:
13
+ ARTIST: !binary |-
14
+ RW5yaXF1ZSBSb2Ryw61ndWV6
15
+ EOD
16
+ hash = YAML.load(data)
17
+ artist = DTAS.try_enc(hash['comments']['ARTIST'], Encoding::UTF_8)
18
+ assert_equal 'Enrique Rodríguez', artist
19
+ end
20
+ end
data/test/test_env.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative 'helper'
data/test/test_fadefx.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative 'helper'
data/test/test_format.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/helper'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/player_integration'
data/test/test_mcache.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2016-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/helper'
data/test/test_mlib.rb CHANGED
@@ -1,10 +1,10 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative 'helper'
5
5
  begin
6
6
  require 'dtas/mlib'
7
- require 'sequel/no_core_ext'
7
+ require 'sequel'
8
8
  require 'sqlite3'
9
9
  rescue LoadError => err
10
10
  warn "skipping mlib test: #{err.message}"
@@ -13,7 +13,7 @@
13
13
 
14
14
  class TestMlib < Testcase
15
15
  def setup
16
- @db = Sequel.sqlite(':memory:')
16
+ @db = Sequel.sqlite(':memory:', case_sensitive_like: false)
17
17
  end
18
18
 
19
19
  def test_migrate
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2015-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/helper'
@@ -0,0 +1,47 @@
1
+ # Copyright (C) 2017-2020 all contributors <dtas-all@nongnu.org>
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
+ # frozen_string_literal: true
4
+ require './test/helper'
5
+ require 'dtas/pipeline'
6
+
7
+ class TestPipeline < Testcase
8
+ include DTAS::Pipeline
9
+ def setup
10
+ @env = ENV.to_hash
11
+ end
12
+
13
+ def pipeline_result
14
+ IO.pipe do |rd, wr|
15
+ begin
16
+ pid = fork do
17
+ rd.close
18
+ $stdout.reopen(wr)
19
+ yield
20
+ exit!(0)
21
+ end
22
+ wr.close
23
+ return rd.read
24
+ ensure
25
+ _, status = Process.waitpid2(pid)
26
+ assert_predicate status, :success?
27
+ end
28
+ end
29
+ nil
30
+ end
31
+
32
+ def test_pipeline
33
+ assert_equal("BYYRU\n", pipeline_result do
34
+ run_pipeline(@env, [
35
+ %w(echo hello), # anything which generates something to stdout
36
+ %w(tr [a-z] [A-Z]), # upcase
37
+ # this lambda runs inside its own process
38
+ lambda do
39
+ $stdin.each_line { |l| $stdout.write("#{l.chomp.reverse}\n") }
40
+ exit!(0)
41
+ end,
42
+ # rot13
43
+ %w(tr [a-m][n-z][A-M][N-Z] [n-z][a-m][N-Z][A-M])
44
+ ])
45
+ end)
46
+ end
47
+ end
data/test/test_player.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/helper'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/helper'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/player_integration'
data/test/test_process.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/helper'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/player_integration'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require './test/helper'
@@ -0,0 +1,20 @@
1
+ # Copyright (C) 2019-2020 all contributors <dtas-all@nongnu.org>
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
+ # frozen_string_literal: true
4
+ require_relative 'helper'
5
+ require 'dtas'
6
+ require 'dtas/sigevent'
7
+
8
+ class TestSigevent < Testcase
9
+ def test_sigevent
10
+ io = DTAS::Sigevent.new
11
+ io.signal
12
+ assert IO.select([io]), 'IO.select returns'
13
+ res = io.readable_iter do |f,arg|
14
+ assert_same io, f
15
+ assert_nil arg
16
+ end
17
+ assert_equal :wait_readable, res
18
+ assert_nil io.close
19
+ end
20
+ end