File: bt-edit-cli.sh

package info (click to toggle)
buzztrax 0.10.2-10
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 19,984 kB
  • sloc: ansic: 109,707; sh: 12,875; cpp: 10,882; xml: 6,081; makefile: 508; javascript: 338; asm: 116
file content (79 lines) | stat: -rwxr-xr-x 1,997 bytes parent folder | download | duplicates (6)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# Buzztrax
# Copyright (C) 2007 Buzztrax team <buzztrax-devel@buzztrax.org>
#
# run buzztrax-edit commandline options
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, see <http://www.gnu.org/licenses/>.

# test the output a little
testHelpOutput()
{
  $LIBTOOL $BUZZTRAX_EDIT --help | grep >/dev/null -- "--help-bt-core"
  assertEquals $? 0
}

testVersionOutput()
{
  $LIBTOOL $BUZZTRAX_EDIT --version | grep >/dev/null -- "buzztrax-edit from buzztrax"
  assertEquals $? 0
}

# here we test that these don't crash
testOptions()
{
  $LIBTOOL $BUZZTRAX_EDIT  >/dev/null --nonsense-option
  assertNotEquals $? 0
}

# tests that launch the UI
testStartup()
{
  $LIBTOOL $BUZZTRAX_EDIT &
  btedit_pid=$!
  sleep 1s && kill $btedit_pid
}

testStartupWithOptions()
{
  $LIBTOOL $BUZZTRAX_EDIT >/dev/null --command=test5 &
  btedit_pid=$!
  sleep 1s && kill $btedit_pid
}

oneTimeSetUp()
{
  # create log dir
  mkdir -p $log_dir
  # TODO(ensonic): use an existing Xvfb if possible, configure flag?
  if [[ "$XVFB_PATH" != "" && "$BT_CHECK_NO_XVFB" == "" ]]; then
    $XVFB_PATH >$log_dir/xvfb.log 2>&1 :9 -ac -nolisten tcp -fp $XFONT_PATH -noreset -screen 0 1024x786x24 -render &
    xvfb_pid=$!
    export DISPLAY=:9
  fi
}

oneTimeTearDown()
{
  if [ "$xvfb_pid" != "" ]; then
    kill $xvfb_pid
  fi
}

xvfb_pid=
log_dir=/tmp/bt_edit_cli
# load configuration
. ./tests/bt-cfg.sh
# load shunit2
. $TESTSRCDIR/shunit2