mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2024-11-03 04:17:18 -05:00
Start with some automated integration/smoke tests
Audio from http://www.audiocheck.net/audiocheck_spectrotyper.php
This commit is contained in:
parent
f367140d82
commit
02edf4f385
21
tests/integration/ezcfg-test1.xml
Normal file
21
tests/integration/ezcfg-test1.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ezstream>
|
||||
|
||||
<server>
|
||||
<hostname>127.0.0.1</hostname>
|
||||
<port>34533</port>
|
||||
<password>ezstream</password>
|
||||
</server>
|
||||
|
||||
<stream>
|
||||
<mountpoint>/test1.ogg</mountpoint>
|
||||
<format>Vorbis</format>
|
||||
</stream>
|
||||
|
||||
<media>
|
||||
<filename>tests.m3u</filename>
|
||||
<stream_once>Yes</stream_once>
|
||||
</media>
|
||||
|
||||
</ezstream>
|
46
tests/integration/icecast.xml
Normal file
46
tests/integration/icecast.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<icecast>
|
||||
<limits>
|
||||
<clients>100</clients>
|
||||
<sources>2</sources>
|
||||
<threadpool>5</threadpool>
|
||||
<queue-size>524288</queue-size>
|
||||
<client-timeout>30</client-timeout>
|
||||
<header-timeout>15</header-timeout>
|
||||
<source-timeout>10</source-timeout>
|
||||
<burst-on-connect>1</burst-on-connect>
|
||||
<burst-size>65535</burst-size>
|
||||
</limits>
|
||||
|
||||
<authentication>
|
||||
<source-password>ezstream</source-password>
|
||||
<relay-password>ezstream</relay-password>
|
||||
<admin-user>admin</admin-user>
|
||||
<admin-password>ezstream</admin-password>
|
||||
</authentication>
|
||||
|
||||
<hostname>127.0.0.1</hostname>
|
||||
|
||||
<listen-socket>
|
||||
<port>34533</port>
|
||||
<bind-address>127.0.0.1</bind-address>
|
||||
</listen-socket>
|
||||
|
||||
<mount>
|
||||
<mount-name>/usertest.ogg</mount-name>
|
||||
<username>ezstream</username>
|
||||
<password>test</password>
|
||||
</mount>
|
||||
|
||||
<fileserve>1</fileserve>
|
||||
|
||||
<paths>
|
||||
<logdir>/tmp</logdir>
|
||||
<!-- <webroot>/usr/share/icecast2/web</webroot> -->
|
||||
<!-- <adminroot>/usr/share/icecast2/admin</adminroot> -->
|
||||
<!-- <pidfile>/usr/share/icecast2/icecast.pid</pidfile> -->
|
||||
</paths>
|
||||
|
||||
<security>
|
||||
<chroot>0</chroot>
|
||||
</security>
|
||||
</icecast>
|
57
tests/integration/test-ezstream.rb
Executable file
57
tests/integration/test-ezstream.rb
Executable file
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env ruby
|
||||
#
|
||||
# encoding: UTF-8
|
||||
|
||||
MYNAME = File.basename($PROGRAM_NAME, '.rb')
|
||||
EZSTREAM = '../../src/ezstream'
|
||||
ICECAST = 'icecast2'
|
||||
|
||||
require 'open3'
|
||||
require 'timeout'
|
||||
|
||||
def test_help
|
||||
STDERR.puts 'test_help'
|
||||
exit_status = 0
|
||||
Open3.popen3(EZSTREAM, '-h') do |i, o, e, wait_thr|
|
||||
exit_status = wait_thr.value.exitstatus
|
||||
end
|
||||
fail "exit_status: 0 != #{exit_status}" if exit_status != 0
|
||||
1
|
||||
rescue => e
|
||||
STDERR.puts 'test_help: ' + e.message
|
||||
0
|
||||
end
|
||||
|
||||
def test_stream
|
||||
STDERR.puts 'test_stream: http://127.0.0.1:34533/test1.ogg'
|
||||
exit_status = 0
|
||||
Open3.popen3(ICECAST, '-c', 'icecast.xml') do |ii, io, ie, icecast|
|
||||
sleep(2) # icecast needs time to boot
|
||||
Open3.popen3(EZSTREAM, '-v', '-v', '-v', '-c', 'ezcfg-test1.xml') do |ei, eo, ee, ezstream|
|
||||
exit_status += ezstream.value.exitstatus
|
||||
puts ee.read.chomp
|
||||
end
|
||||
sleep(1)
|
||||
Process.kill(15, icecast.pid)
|
||||
end
|
||||
fail "exit_status: 0 != #{exit_status}" if exit_status != 0
|
||||
1
|
||||
rescue => e
|
||||
STDERR.puts 'test_stream: ' + e.message
|
||||
0
|
||||
end
|
||||
|
||||
num_tests = 0
|
||||
num_passed = 0
|
||||
|
||||
num_tests += 1
|
||||
num_passed += test_help
|
||||
|
||||
num_tests += 1
|
||||
num_passed += test_stream
|
||||
|
||||
success_rate = num_passed.to_f.fdiv(num_tests.to_f) * 100
|
||||
|
||||
STDERR.puts "#{num_passed}/#{num_tests} passed (#{(success_rate.round)}%)"
|
||||
|
||||
exit num_tests == num_passed ? 0 : 1
|
BIN
tests/integration/test1.ogg
Normal file
BIN
tests/integration/test1.ogg
Normal file
Binary file not shown.
BIN
tests/integration/test2.ogg
Normal file
BIN
tests/integration/test2.ogg
Normal file
Binary file not shown.
2
tests/integration/tests.m3u
Normal file
2
tests/integration/tests.m3u
Normal file
@ -0,0 +1,2 @@
|
||||
test1.ogg
|
||||
test2.ogg
|
Loading…
Reference in New Issue
Block a user