summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am17
-rw-r--r--test/lv2.cc546
-rw-r--r--test/resource_test.cc72
-rwxr-xr-xtest/run_test.sh24
4 files changed, 388 insertions, 271 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 1f605e5..8a746a6 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,11 +1,21 @@
# Rules for the test code (use `make check` to execute)
include $(top_srcdir)/src/Makefile.am.drumgizmo
-TESTS = engine gui resampler lv2 configfile audiocache audiocachefile \
- audiocacheidmanager audiocacheeventhandler
+TESTS = resource engine gui resampler lv2 configfile audiocache \
+ audiocachefile audiocacheidmanager audiocacheeventhandler
check_PROGRAMS = $(TESTS)
+resource_CXXFLAGS = -DOUTPUT=\"resource\" $(CPPUNIT_CFLAGS) \
+ -I$(top_srcdir)/hugin
+resource_LDFLAGS = $(CPPUNIT_LIBS)
+resource_SOURCES = \
+ $(top_srcdir)/plugingui/resource.cc \
+ $(top_srcdir)/plugingui/resource_data.cc \
+ $(top_srcdir)/hugin/hugin.c \
+ test.cc \
+ resource_test.cc
+
audiocache_CXXFLAGS = -DOUTPUT=\"audiocache\" $(CPPUNIT_CFLAGS) \
-I$(top_srcdir)/src -I$(top_srcdir)/include \
-I$(top_srcdir)/hugin -DDISABLE_HUGIN $(PTHREAD_CFLAGS) $(SNDFILE_CFLAGS)
@@ -106,3 +116,6 @@ configfile_SOURCES = \
$(top_srcdir)/hugin/hugin.c \
test.cc \
configtest.cc
+
+EXTRA_DIST = \
+ lv2_test_host.h
diff --git a/test/lv2.cc b/test/lv2.cc
index bfd2ce5..32d896c 100644
--- a/test/lv2.cc
+++ b/test/lv2.cc
@@ -47,7 +47,7 @@
*/
class test_lv2 : public CppUnit::TestFixture
{
- CPPUNIT_TEST_SUITE(test_lv2);
+ CPPUNIT_TEST_SUITE(test_lv2);
CPPUNIT_TEST(open_and_verify);
CPPUNIT_TEST(run_no_ports_connected);
CPPUNIT_TEST(run_no_output_ports_connected);
@@ -58,274 +58,282 @@ public:
void setUp() {}
void tearDown() {}
- void open_and_verify()
- {
- int res;
-
- LV2TestHost h(LV2_PATH);
-
- res = h.open(DG_URI);
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.verify();
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.close();
- CPPUNIT_ASSERT_EQUAL(0, res);
- }
-
- void run_no_ports_connected()
- {
- int res;
-
- LV2TestHost h(LV2_PATH);
-
- res = h.open(DG_URI);
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.verify();
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.createInstance();
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- const char config_fmt[] =
- "<config>\n"
- " <value name=\"drumkitfile\">%s</value>\n"
- " <value name=\"midimapfile\">%s</value>\n"
- " <value name=\"enable_velocity_modifier\">%s</value>\n"
- " <value name=\"velocity_modifier_falloff\">%f</value>\n"
- " <value name=\"velocity_modifier_weight\">%f</value>\n"
- " <value name=\"enable_velocity_randomiser\">%s</value>\n"
- " <value name=\"velocity_randomiser_weight\">%f</value>\n"
- " <value name=\"enable_resampling\">%s</value>\n"
- "</config>";
-
- const char drumkitfile[] = "kit/kit1.xml";
- const char midimapfile[] = "kit/midimap.xml";
- bool enable_velocity_modifier = true;
- float velocity_modifier_falloff = 0.5;
- float velocity_modifier_weight = 0.25;
- bool enable_velocity_randomiser = false;
- float velocity_randomiser_weight = 0.1;
- bool enable_resampling = false;
-
- char config[sizeof(config_fmt) * 2];
- sprintf(config, config_fmt,
- drumkitfile,
- midimapfile,
- enable_velocity_modifier?"true":"false",
- velocity_modifier_falloff,
- velocity_modifier_weight,
- enable_velocity_randomiser?"true":"false",
- velocity_randomiser_weight,
- enable_resampling?"true":"false"
- );
-
- res = h.loadConfig(config, strlen(config));
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- // run for 1 samples to trigger kit loading
- res = h.run(1);
- CPPUNIT_ASSERT_EQUAL(0, res);
- sleep(1); // wait for kit to get loaded (async),
-
- res = h.run(100);
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.destroyInstance();
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.close();
- CPPUNIT_ASSERT_EQUAL(0, res);
- }
-
- void run_no_output_ports_connected()
- {
- int res;
-
- LV2TestHost h(LV2_PATH);
-
- res = h.open(DG_URI);
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.verify();
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.createInstance();
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- const char config_fmt[] =
- "<config>\n"
- " <value name=\"drumkitfile\">%s</value>\n"
- " <value name=\"midimapfile\">%s</value>\n"
- " <value name=\"enable_velocity_modifier\">%s</value>\n"
- " <value name=\"velocity_modifier_falloff\">%f</value>\n"
- " <value name=\"velocity_modifier_weight\">%f</value>\n"
- " <value name=\"enable_velocity_randomiser\">%s</value>\n"
- " <value name=\"velocity_randomiser_weight\">%f</value>\n"
- " <value name=\"enable_resampling\">%s</value>\n"
- "</config>";
-
- const char drumkitfile[] = "kit/kit1.xml";
- const char midimapfile[] = "kit/midimap.xml";
- bool enable_velocity_modifier = true;
- float velocity_modifier_falloff = 0.5;
- float velocity_modifier_weight = 0.25;
- bool enable_velocity_randomiser = false;
- float velocity_randomiser_weight = 0.1;
- bool enable_resampling = false;
-
- char config[sizeof(config_fmt) * 2];
- sprintf(config, config_fmt,
- drumkitfile,
- midimapfile,
- enable_velocity_modifier?"true":"false",
- velocity_modifier_falloff,
- velocity_modifier_weight,
- enable_velocity_randomiser?"true":"false",
- velocity_randomiser_weight,
- enable_resampling?"true":"false"
- );
-
- res = h.loadConfig(config, strlen(config));
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- // Port buffers:
- char sequence_buffer[4096];
-
- LV2TestHost::Sequence seq(sequence_buffer, sizeof(sequence_buffer));
- res = h.connectPort(0, seq.data());
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- // run for 1 samples to trigger kit loading
- res = h.run(1);
- CPPUNIT_ASSERT_EQUAL(0, res);
- sleep(1); // wait for kit to get loaded (async),
-
- seq.addMidiNote(5, 1, 127);
- res = h.run(100);
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.destroyInstance();
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.close();
- CPPUNIT_ASSERT_EQUAL(0, res);
- }
-
- void test1()
- {
- int res;
-
- LV2TestHost h(LV2_PATH);
-
- res = h.open(DG_URI);
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.verify();
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.createInstance();
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- const char config_fmt[] =
- "<config>\n"
- " <value name=\"drumkitfile\">%s</value>\n"
- " <value name=\"midimapfile\">%s</value>\n"
- " <value name=\"enable_velocity_modifier\">%s</value>\n"
- " <value name=\"velocity_modifier_falloff\">%f</value>\n"
- " <value name=\"velocity_modifier_weight\">%f</value>\n"
- " <value name=\"enable_velocity_randomiser\">%s</value>\n"
- " <value name=\"velocity_randomiser_weight\">%f</value>\n"
- " <value name=\"enable_resampling\">%s</value>\n"
- "</config>";
-
- const char drumkitfile[] = "kit/kit1.xml";
- const char midimapfile[] = "kit/midimap.xml";
- bool enable_velocity_modifier = true;
- float velocity_modifier_falloff = 0.5;
- float velocity_modifier_weight = 0.25;
- bool enable_velocity_randomiser = false;
- float velocity_randomiser_weight = 0.1;
- bool enable_resampling = false;
-
- char config[sizeof(config_fmt) * 2];
- sprintf(config, config_fmt,
- drumkitfile,
- midimapfile,
- enable_velocity_modifier?"true":"false",
- velocity_modifier_falloff,
- velocity_modifier_weight,
- enable_velocity_randomiser?"true":"false",
- velocity_randomiser_weight,
- enable_resampling?"true":"false"
- );
-
- res = h.loadConfig(config, strlen(config));
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- // Port buffers:
- char sequence_buffer[4096];
- float pcm_buffer[16][10];
-
- LV2TestHost::Sequence seq(sequence_buffer, sizeof(sequence_buffer));
- res = h.connectPort(0, seq.data());
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- for(int i = 1; i <= 16; i++) {
- memset(pcm_buffer, 1, sizeof(pcm_buffer));
- res += h.connectPort(i, pcm_buffer[i-1]);
- }
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- // run for 1 samples to trigger kit loading
- res = h.run(1);
- CPPUNIT_ASSERT_EQUAL(0, res);
- sleep(1); // wait for kit to get loaded (async),
-
- /*
- seq.addMidiNote(5, 1, 127);
- for(int i = 0; i < 10; i++) {
- res = h.run(10);
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- printf("Iteration:\n");
- for(int k = 0; k < 4; k++) {
- printf("#%d ", k);
- for(int j = 0; j < 10; j++) printf("[%f]", pcm_buffer[k][j]);
- printf("\n");
- }
- printf("\n");
-
- seq.clear();
- }
- */
-
- seq.addMidiNote(5, 1, 127);
- res = h.run(10);
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- union {
- float f;
- unsigned int u;
- } comp_val;
-
- comp_val.u = 1040744448;
-
- for(int k = 0; k < 4; k++) {
- for(int j = 0; j < 10; j++) {
- CPPUNIT_ASSERT(pcm_buffer[k][j] == ((j==4)?comp_val.f:0));
- }
- }
- seq.clear();
-
- res = h.destroyInstance();
- CPPUNIT_ASSERT_EQUAL(0, res);
-
- res = h.close();
- CPPUNIT_ASSERT_EQUAL(0, res);
- }
+ void open_and_verify()
+ {
+ int res;
+
+ LV2TestHost h(LV2_PATH);
+
+ res = h.open(DG_URI);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.verify();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.close();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+ }
+
+ void run_no_ports_connected()
+ {
+ int res;
+
+ LV2TestHost h(LV2_PATH);
+
+ res = h.open(DG_URI);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.verify();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.createInstance();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ const char config_fmt[] =
+ "<config>\n"
+ " <value name=\"drumkitfile\">%s</value>\n"
+ " <value name=\"midimapfile\">%s</value>\n"
+ " <value name=\"enable_velocity_modifier\">%s</value>\n"
+ " <value name=\"velocity_modifier_falloff\">%f</value>\n"
+ " <value name=\"velocity_modifier_weight\">%f</value>\n"
+ " <value name=\"enable_velocity_randomiser\">%s</value>\n"
+ " <value name=\"velocity_randomiser_weight\">%f</value>\n"
+ " <value name=\"enable_resampling\">%s</value>\n"
+ "</config>";
+
+ const char drumkitfile[] = "kit/kit1.xml";
+ const char midimapfile[] = "kit/midimap.xml";
+ bool enable_velocity_modifier = true;
+ float velocity_modifier_falloff = 0.5;
+ float velocity_modifier_weight = 0.25;
+ bool enable_velocity_randomiser = false;
+ float velocity_randomiser_weight = 0.1;
+ bool enable_resampling = false;
+
+ char config[sizeof(config_fmt) * 2];
+ sprintf(config, config_fmt,
+ drumkitfile,
+ midimapfile,
+ enable_velocity_modifier?"true":"false",
+ velocity_modifier_falloff,
+ velocity_modifier_weight,
+ enable_velocity_randomiser?"true":"false",
+ velocity_randomiser_weight,
+ enable_resampling?"true":"false");
+
+ res = h.loadConfig(config, strlen(config));
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ // run for 1 samples to trigger kit loading
+ res = h.run(1);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+ sleep(1); // wait for kit to get loaded (async),
+
+ res = h.run(100);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.destroyInstance();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.close();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+ }
+
+ void run_no_output_ports_connected()
+ {
+ int res;
+
+ LV2TestHost h(LV2_PATH);
+
+ res = h.open(DG_URI);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.verify();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.createInstance();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ const char config_fmt[] =
+ "<config>\n"
+ " <value name=\"drumkitfile\">%s</value>\n"
+ " <value name=\"midimapfile\">%s</value>\n"
+ " <value name=\"enable_velocity_modifier\">%s</value>\n"
+ " <value name=\"velocity_modifier_falloff\">%f</value>\n"
+ " <value name=\"velocity_modifier_weight\">%f</value>\n"
+ " <value name=\"enable_velocity_randomiser\">%s</value>\n"
+ " <value name=\"velocity_randomiser_weight\">%f</value>\n"
+ " <value name=\"enable_resampling\">%s</value>\n"
+ "</config>";
+
+ const char drumkitfile[] = "kit/kit1.xml";
+ const char midimapfile[] = "kit/midimap.xml";
+ bool enable_velocity_modifier = true;
+ float velocity_modifier_falloff = 0.5;
+ float velocity_modifier_weight = 0.25;
+ bool enable_velocity_randomiser = false;
+ float velocity_randomiser_weight = 0.1;
+ bool enable_resampling = false;
+
+ char config[sizeof(config_fmt) * 2];
+ sprintf(config, config_fmt,
+ drumkitfile,
+ midimapfile,
+ enable_velocity_modifier?"true":"false",
+ velocity_modifier_falloff,
+ velocity_modifier_weight,
+ enable_velocity_randomiser?"true":"false",
+ velocity_randomiser_weight,
+ enable_resampling?"true":"false");
+
+ res = h.loadConfig(config, strlen(config));
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ // Port buffers:
+ char sequence_buffer[4096];
+
+ LV2TestHost::Sequence seq(sequence_buffer, sizeof(sequence_buffer));
+ res = h.connectPort(0, seq.data());
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ // run for 1 samples to trigger kit loading
+ res = h.run(1);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+ sleep(1); // wait for kit to get loaded (async),
+
+ seq.addMidiNote(5, 1, 127);
+ res = h.run(100);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.destroyInstance();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.close();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+ }
+
+ void test1()
+ {
+ int res;
+
+ LV2TestHost h(LV2_PATH);
+
+ res = h.open(DG_URI);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.verify();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.createInstance();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ const char config_fmt[] =
+ "<config>\n"
+ " <value name=\"drumkitfile\">%s</value>\n"
+ " <value name=\"midimapfile\">%s</value>\n"
+ " <value name=\"enable_velocity_modifier\">%s</value>\n"
+ " <value name=\"velocity_modifier_falloff\">%f</value>\n"
+ " <value name=\"velocity_modifier_weight\">%f</value>\n"
+ " <value name=\"enable_velocity_randomiser\">%s</value>\n"
+ " <value name=\"velocity_randomiser_weight\">%f</value>\n"
+ " <value name=\"enable_resampling\">%s</value>\n"
+ "</config>";
+
+ const char drumkitfile[] = "kit/kit1.xml";
+ const char midimapfile[] = "kit/midimap.xml";
+ bool enable_velocity_modifier = true;
+ float velocity_modifier_falloff = 0.5;
+ float velocity_modifier_weight = 0.25;
+ bool enable_velocity_randomiser = false;
+ float velocity_randomiser_weight = 0.1;
+ bool enable_resampling = false;
+
+ char config[sizeof(config_fmt) * 2];
+ sprintf(config, config_fmt,
+ drumkitfile,
+ midimapfile,
+ enable_velocity_modifier?"true":"false",
+ velocity_modifier_falloff,
+ velocity_modifier_weight,
+ enable_velocity_randomiser?"true":"false",
+ velocity_randomiser_weight,
+ enable_resampling?"true":"false");
+
+ res = h.loadConfig(config, strlen(config));
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ // Port buffers:
+ char sequence_buffer[4096];
+ float pcm_buffer[16][10];
+
+ LV2TestHost::Sequence seq(sequence_buffer, sizeof(sequence_buffer));
+ res = h.connectPort(0, seq.data());
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ for(int i = 1; i <= 16; i++) {
+ memset(pcm_buffer, 1, sizeof(pcm_buffer));
+ res += h.connectPort(i, pcm_buffer[i-1]);
+ }
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ // run for 1 samples to trigger kit loading
+ res = h.run(1);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+ sleep(1); // wait for kit to get loaded (async),
+
+ seq.addMidiNote(5, 1, 127);
+ for(int i = 0; i < 10; i++) {
+ res = h.run(10);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ /*
+ printf("Iteration:\n");
+ for(int k = 0; k < 4; k++) {
+ printf("#%d ", k);
+ for(int j = 0; j < 10; j++) printf("[%f]", pcm_buffer[k][j]);
+ printf("\n");
+ }
+ printf("\n");
+ */
+
+ seq.clear();
+ }
+
+
+ seq.addMidiNote(5, 1, 127);
+ res = h.run(10);
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ /*
+ printf("Iteration:\n");
+ for(int k = 0; k < 4; k++) {
+ printf("#%d ", k);
+ for(int j = 0; j < 10; j++) printf("[%f]", pcm_buffer[k][j]);
+ printf("\n");
+ }
+ printf("\n");
+ */
+
+ union {
+ float f;
+ unsigned int u;
+ } comp_val;
+
+ comp_val.u = 1040744448; // floating point value 0.133301....
+
+ for(int k = 0; k < 4; k++) {
+ for(int j = 0; j < 10; j++) {
+ CPPUNIT_ASSERT_EQUAL(((j==0)?comp_val.f:0), pcm_buffer[k][j]);
+ }
+ }
+ seq.clear();
+
+ res = h.destroyInstance();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+
+ res = h.close();
+ CPPUNIT_ASSERT_EQUAL(0, res);
+ }
};
// Registers the fixture into the 'registry'
diff --git a/test/resource_test.cc b/test/resource_test.cc
new file mode 100644
index 0000000..7fc632a
--- /dev/null
+++ b/test/resource_test.cc
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ * resource_test.cc
+ *
+ * Fri Nov 13 18:50:52 CET 2015
+ * Copyright 2015 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of DrumGizmo.
+ *
+ * DrumGizmo is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * DrumGizmo 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with DrumGizmo; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "../plugingui/resource.h"
+
+class ResourceTester : public GUI::Resource {
+public:
+ ResourceTester(const std::string& name)
+ : Resource(name)
+ {}
+
+ bool probeIsInternal()
+ {
+ return isInternal;
+ }
+};
+
+class ResourceTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE(ResourceTest);
+ CPPUNIT_TEST(externalReadTest);
+ CPPUNIT_TEST(internalReadTest);
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void setUp() {}
+ void tearDown() {}
+
+ void externalReadTest()
+ {
+ ResourceTester rc("kit/0000.wav");
+ CPPUNIT_ASSERT(!rc.probeIsInternal());
+ CPPUNIT_ASSERT(rc.valid());
+ CPPUNIT_ASSERT_EQUAL((size_t)46, rc.size());
+ }
+
+ void internalReadTest()
+ {
+ ResourceTester rc(":bg.png");
+ CPPUNIT_ASSERT(rc.probeIsInternal());
+ CPPUNIT_ASSERT(rc.valid());
+ CPPUNIT_ASSERT_EQUAL((size_t)1123, rc.size());
+ }
+};
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION(ResourceTest);
diff --git a/test/run_test.sh b/test/run_test.sh
new file mode 100755
index 0000000..51b99c4
--- /dev/null
+++ b/test/run_test.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# This is a script to faciliate running single tests.
+#
+# Usage: ./run_test.sh <test_1> <test_2> ... <test_n>
+# If no test string is passed then all tests are run.
+
+test_dir=$(dirname $0)
+cd $test_dir
+
+if [[ $# == 0 ]]
+then
+ echo "======================"
+ echo "All tests are now run."
+ echo "======================"
+ make check
+else
+ for TST in "$@"
+ do
+ echo "========================="
+ echo "The $TST test is now run."
+ echo "========================="
+ rm -f $TST*.o; make $TST && (./$TST; RES=$?; echo; echo "Result: $RES"; cat result_$TST.xml)
+ done
+fi