summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-02-17 08:46:23 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-02-17 08:46:23 +0100
commit88e7ddfa797232582e91ccb55655784f59be4589 (patch)
tree58d2391ef0aa96db1c49a2a355f82f01e019c749 /tests
parentcbc53b2cdca379f07f60dcf6d59983962048cfea (diff)
downloadufo-filters-88e7ddfa797232582e91ccb55655784f59be4589.tar.gz
ufo-filters-88e7ddfa797232582e91ccb55655784f59be4589.tar.bz2
ufo-filters-88e7ddfa797232582e91ccb55655784f59be4589.tar.xz
ufo-filters-88e7ddfa797232582e91ccb55655784f59be4589.zip
Integration tests have been moved to core
Diffstat (limited to 'tests')
-rw-r--r--tests/integration_tests/CMakeLists.txt23
-rwxr-xr-xtests/integration_tests/run_local.sh4
-rw-r--r--tests/integration_tests/test-complete-local-setup.c127
-rw-r--r--tests/integration_tests/test-complete-remote-setup.c145
-rw-r--r--tests/integration_tests/test-suite.c45
-rw-r--r--tests/integration_tests/test-suite.h7
6 files changed, 0 insertions, 351 deletions
diff --git a/tests/integration_tests/CMakeLists.txt b/tests/integration_tests/CMakeLists.txt
deleted file mode 100644
index e90d28d..0000000
--- a/tests/integration_tests/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-# configure unit tests
-set(TEST_SRCS
- test-suite.c
- test-complete-local-setup.c
- test-complete-remote-setup.c
-)
-
-pkg_check_modules(GLIB glib-2.0 REQUIRED)
-pkg_check_modules(GOBJECT gobject-2.0 REQUIRED)
-
-set(SUITE_BIN "test-suite")
-include_directories(${UFO_INCLUDE_DIRS}
- ${GLIB_INCLUDE_DIRS}
- ${GOBJECT_INCLUDE_DIRS})
-add_executable(${SUITE_BIN} ${TEST_SRCS})
-
-link_directories(${UFO_LIBRARY_DIRS})
-target_link_libraries(${SUITE_BIN}
- ${GLIB_LIBRARIES}
- ${GOBJECT_LIBRARIES}
- ufo)
diff --git a/tests/integration_tests/run_local.sh b/tests/integration_tests/run_local.sh
deleted file mode 100755
index 33d75d2..0000000
--- a/tests/integration_tests/run_local.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-# use the filters in this project, not the system-wide intalled ones
-UFO_PLUGIN_PATH="`pwd`/../../src/" ./test-suite
diff --git a/tests/integration_tests/test-complete-local-setup.c b/tests/integration_tests/test-complete-local-setup.c
deleted file mode 100644
index f7766e0..0000000
--- a/tests/integration_tests/test-complete-local-setup.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2011-2013 Karlsruhe Institute of Technology
- *
- * This file is part of Ufo.
- *
- * This library is free software: you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <ufo/ufo.h>
-#include <glib/gstdio.h>
-#include "test-suite.h"
-
-typedef struct {
- gchar *tmpdir;
-} Fixture;
-
-static void
-setup (Fixture *fixture, gconstpointer data)
-{
- fixture->tmpdir = g_strdup ("ufotemp-XXXXXX");
- g_mkdtemp (fixture->tmpdir);
-}
-
-static void
-teardown (Fixture *fixture, gconstpointer data)
-{
- g_rmdir (fixture->tmpdir);
- g_free (fixture->tmpdir);
-}
-
-static void
-test_simple_invert (Fixture *fixture,
- gconstpointer unused)
-{
- //double-invert an image should equal original image
- UfoPluginManager *mgr = ufo_plugin_manager_new ();
-
- const gchar *input_image = "../data/sinogram-00000.tif";
- const gchar *output_image = g_strconcat (fixture->tmpdir, "/", "sinogram-00000-inverted.tif", NULL);
-
- const gchar *kernel_source =
- "__kernel void invert(__global float *input, __global float *output) "
- "{ "
- "int index = get_global_id(1) * get_global_size(0) + get_global_id(0); "
- "output[index] = 1.0f - input[index]; "
- "} "
- ;
-
- UfoTaskNode *reader = ufo_plugin_manager_get_task (mgr, "reader", NULL);
- UfoTaskNode *writer = ufo_plugin_manager_get_task (mgr, "writer", NULL);
- UfoTaskNode *cl1 = ufo_plugin_manager_get_task (mgr, "opencl", NULL);
- UfoTaskNode *cl2 = ufo_plugin_manager_get_task (mgr, "opencl", NULL);
-
- GValue input_file = G_VALUE_INIT,
- output_file = G_VALUE_INIT,
- output_single = G_VALUE_INIT,
- kernel_code = G_VALUE_INIT,
- kernel_name = G_VALUE_INIT;
-
- g_value_init (&input_file, G_TYPE_STRING);
- g_value_init (&output_file, G_TYPE_STRING);
- g_value_init (&output_single, G_TYPE_BOOLEAN);
- g_value_init (&kernel_code, G_TYPE_STRING);
- g_value_init (&kernel_name, G_TYPE_STRING);
-
- g_value_set_static_string (&input_file, input_image);
- g_object_set_property (G_OBJECT (reader), "path", &input_file);
-
- g_value_set_static_string (&output_file, output_image);
- g_object_set_property (G_OBJECT (writer), "filename", &output_file);
- g_value_set_boolean (&output_single, TRUE);
- g_object_set_property (G_OBJECT (writer), "single-file", &output_single);
-
- g_value_set_static_string (&kernel_code, kernel_source);
- g_object_set_property (G_OBJECT (cl1), "source", &kernel_code);
- g_object_set_property (G_OBJECT (cl2), "source", &kernel_code);
- g_value_set_static_string (&kernel_name, "invert");
- g_object_set_property (G_OBJECT (cl1), "kernel", &kernel_name);
- g_object_set_property (G_OBJECT (cl2), "kernel", &kernel_name);
-
- UfoGraph *graph = UFO_GRAPH (ufo_task_graph_new ());
- ufo_graph_connect_nodes (graph, UFO_NODE (reader), UFO_NODE (cl1), NULL);
- ufo_graph_connect_nodes (graph, UFO_NODE (cl1), UFO_NODE (cl2), NULL);
- ufo_graph_connect_nodes (graph, UFO_NODE (cl2), UFO_NODE (writer), NULL);
-
- UfoBaseScheduler *sched = ufo_scheduler_new ();
- ufo_base_scheduler_run (sched, UFO_TASK_GRAPH (graph), NULL);
-
- // test that an output was generated
- g_assert (g_file_test (output_image, G_FILE_TEST_EXISTS));
-
- // check that the file size matches our expectation
- GMappedFile *file_out = g_mapped_file_new (output_image, FALSE, NULL);
- gsize len_actual = g_mapped_file_get_length (file_out);
- gsize len_expected = 1048722;
-
- g_assert (len_expected == len_actual);
-
- g_mapped_file_unref (file_out);
- g_remove (output_image);
-
- g_object_unref (reader);
- g_object_unref (writer);
- g_object_unref (cl1);
- g_object_unref (cl2);
- g_object_unref (graph);
- g_object_unref (mgr);
-}
-
-void
-test_add_complete_local_setup (void)
-{
- g_test_add ("/complete_local_setup/simple_invert",
- Fixture, NULL,
- setup, test_simple_invert, teardown);
-}
diff --git a/tests/integration_tests/test-complete-remote-setup.c b/tests/integration_tests/test-complete-remote-setup.c
deleted file mode 100644
index f13ccc2..0000000
--- a/tests/integration_tests/test-complete-remote-setup.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2011-2013 Karlsruhe Institute of Technology
- *
- * This file is part of Ufo.
- *
- * This library is free software: you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <ufo/ufo.h>
-#include <glib/gstdio.h>
-#include "test-suite.h"
-
-typedef struct {
- UfoDaemon *daemon;
- gchar *tmpdir;
-} Fixture;
-
-static void
-setup (Fixture *fixture, gconstpointer data)
-{
- GError *error = NULL;
- gchar *addr = g_strdup ("tcp://127.0.0.1:5555");
-
- fixture->daemon = ufo_daemon_new (addr);
- ufo_daemon_start (fixture->daemon, &error);
- g_assert_no_error (error);
-
- fixture->tmpdir = g_strdup ("ufotemp-XXXXXX");
- g_mkdtemp (fixture->tmpdir);
-}
-
-static void
-teardown (Fixture *fixture, gconstpointer data)
-{
- GError *error = NULL;
-
- ufo_daemon_stop (fixture->daemon, &error);
- g_assert_no_error (error);
-
- g_object_unref (fixture->daemon);
-
- g_rmdir (fixture->tmpdir);
- g_free (fixture->tmpdir);
-}
-
-static void
-test_simple_invert (Fixture *fixture,
- gconstpointer unused)
-{
- //double-invert an image should equal original image
- UfoPluginManager *mgr = ufo_plugin_manager_new ();
-
- const gchar *input_image = "../data/sinogram-00000.tif";
- const gchar *output_image = g_strconcat (fixture->tmpdir, "/", "sinogram-00000-inverted.tif", NULL);
-
- const gchar *kernel_source =
- "__kernel void invert(__global float *input, __global float *output) "
- "{ "
- "int index = get_global_id(1) * get_global_size(0) + get_global_id(0); "
- "output[index] = 1.0f - input[index]; "
- "} "
- ;
-
- UfoTaskNode *reader = ufo_plugin_manager_get_task (mgr, "reader", NULL);
- UfoTaskNode *writer = ufo_plugin_manager_get_task (mgr, "writer", NULL);
- UfoTaskNode *cl1 = ufo_plugin_manager_get_task (mgr, "opencl", NULL);
- UfoTaskNode *cl2 = ufo_plugin_manager_get_task (mgr, "opencl", NULL);
-
- GValue input_file = G_VALUE_INIT,
- output_file = G_VALUE_INIT,
- output_single = G_VALUE_INIT,
- kernel_code = G_VALUE_INIT,
- kernel_name = G_VALUE_INIT;
-
- g_value_init (&input_file, G_TYPE_STRING);
- g_value_init (&output_file, G_TYPE_STRING);
- g_value_init (&output_single, G_TYPE_BOOLEAN);
- g_value_init (&kernel_code, G_TYPE_STRING);
- g_value_init (&kernel_name, G_TYPE_STRING);
-
- g_value_set_static_string (&input_file, input_image);
- g_object_set_property (G_OBJECT (reader), "path", &input_file);
-
- g_value_set_static_string (&output_file, output_image);
- g_object_set_property (G_OBJECT (writer), "filename", &output_file);
- g_value_set_boolean (&output_single, TRUE);
- g_object_set_property (G_OBJECT (writer), "single-file", &output_single);
-
- g_value_set_static_string (&kernel_code, kernel_source);
- g_object_set_property (G_OBJECT (cl1), "source", &kernel_code);
- g_object_set_property (G_OBJECT (cl2), "source", &kernel_code);
- g_value_set_static_string (&kernel_name, "invert");
- g_object_set_property (G_OBJECT (cl1), "kernel", &kernel_name);
- g_object_set_property (G_OBJECT (cl2), "kernel", &kernel_name);
-
- UfoGraph *graph = UFO_GRAPH (ufo_task_graph_new ());
- ufo_graph_connect_nodes (graph, UFO_NODE (reader), UFO_NODE (cl1), NULL);
- ufo_graph_connect_nodes (graph, UFO_NODE (cl1), UFO_NODE (cl2), NULL);
- ufo_graph_connect_nodes (graph, UFO_NODE (cl2), UFO_NODE (writer), NULL);
-
- gchar *remote = g_strdup ("tcp://127.0.0.1:5555");
- UfoBaseScheduler *sched = ufo_scheduler_new ();
-
- ufo_base_scheduler_run (sched, UFO_TASK_GRAPH (graph), NULL);
- g_free(remote);
-
- // test that an output was generated
- g_assert (g_file_test (output_image, G_FILE_TEST_EXISTS));
-
- // check that the file size matches our expectation
- GMappedFile *file_out = g_mapped_file_new (output_image, FALSE, NULL);
- gsize len_actual = g_mapped_file_get_length (file_out);
- gsize len_expected = 1048722;
-
- g_assert (len_expected == len_actual);
-
- g_mapped_file_unref (file_out);
- g_remove (output_image);
-
- g_object_unref (reader);
- g_object_unref (writer);
- g_object_unref (cl1);
- g_object_unref (cl2);
- g_object_unref (graph);
- g_object_unref (mgr);
-}
-
-void
-test_add_complete_remote_setup (void)
-{
- g_test_add ("/complete_remote_setup/simple_invert",
- Fixture, NULL,
- setup, test_simple_invert, teardown);
-}
diff --git a/tests/integration_tests/test-suite.c b/tests/integration_tests/test-suite.c
deleted file mode 100644
index 3a1bbe8..0000000
--- a/tests/integration_tests/test-suite.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2011-2013 Karlsruhe Institute of Technology
- *
- * This file is part of Ufo.
- *
- * This library is free software: you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <glib-object.h>
-#include "test-suite.h"
-
-static void
-test_log (const gchar *domain,
- GLogLevelFlags flags,
- const gchar *message,
- gpointer data)
-{
- // g_print ("%s\n",message);
-}
-
-int main(int argc, char *argv[])
-{
- g_type_init();
- g_test_init(&argc, &argv, NULL);
- g_test_bug_base("http://ufo.kit.edu/ufo/ticket");
-
- g_log_set_handler ("Ufo", G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, test_log, NULL);
- g_log_set_handler ("ocl", G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, test_log, NULL);
-
- test_add_complete_local_setup ();
- test_add_complete_remote_setup ();
- g_test_run();
- return 0;
-}
diff --git a/tests/integration_tests/test-suite.h b/tests/integration_tests/test-suite.h
deleted file mode 100644
index b476a0e..0000000
--- a/tests/integration_tests/test-suite.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef TEST_SUITE_H
-#define TEST_SUITE_H
-
-void test_add_complete_local_setup (void);
-void test_add_complete_remote_setup (void);
-
-#endif