-/* This file contains test-runner
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- * Author: Kazimierz Krosman <k.krosman@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/* The MIT License
+
+ Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ Author: Kazimierz Krosman <k.krosman@samsung.com>
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
*/
#include <unistd.h>
#define MAX_BUFFER (64*1024)
#define MAX_COMMENT 1024
+#define INSTALLED_TESTS_DIR "/usr/lib/dbus/installed-tests/dbus/data"
+
enum {
INIT_TEST,
NEW_STDOUT,
char** prepare_args_for_dir_iter(const struct binary* b, const char* test_name);
int init_environment_vars();
-static struct test_case desc_1[] = {
- {"", "Simple sanity-check for authentication and authorization."}, {NULL, NULL}
-};
static struct test_case desc_2[] = {
{"", "Testing DBus ability to iterate over directory contents."}, {NULL, NULL}
};
/* This table is used to start binaries */
struct binary tests[] = {
/*path, name, TC_table, timeout in us, prepare_args_handler, parse_function_handler, init_handler, clean_handler*/
- {"/usr/lib/dbus-tests/test-suites/dbus-tests/manual-authz",
- "manual-authz", desc_1, 1000*1000, prepare_args_for_binary, parse_binary_outputs, init_environment_vars, NULL},
{"/usr/lib/dbus-tests/test-suites/dbus-tests/manual-dir-iter",
"manual-dir-iter", desc_2, 1000*1000, prepare_args_for_dir_iter, parse_binary_outputs, init_environment_vars, NULL},
{"/usr/lib/dbus-tests/test-suites/dbus-tests/manual-tcp",
{
static char* args_dir[2];
args_dir[0] = (char*)b->name;
- args_dir[1] = "/usr/lib/dbus-tests/test-suites/dbus-tests/data";
+ args_dir[1] = INSTALLED_TESTS_DIR;
return args_dir;
}
int init_environment_vars()
{
- return !(putenv("DBUS_TEST_DATA=/usr/lib/dbus-tests/test-suites/dbus-tests/data"));
+ return !(putenv("DBUS_TEST_DATA="INSTALLED_TESTS_DIR));
}
void parse_binary_outputs(const struct binary* b, const char* test_name, char* buffer, int state_change, int state_option)
static int stdout_pipe[2];
static int stderr_pipe[2];
static int gravedigger_pipe[2];
-static struct test_result test_results[MAX_TC_NUM];
-static int test_results_i;
static char buffer[MAX_BUFFER];
static const char* requested_tc[MAX_TC_NUM];
void add_test_result(const char* test_id, const char* result, const char* comment, int res)
{
- test_results[test_results_i].is_positive = res;
- strcpy(test_results[test_results_i].result, result);
- strcpy(test_results[test_results_i].comment, comment);
- strcpy(test_results[test_results_i++].name, test_id);
-}
-
-static void print_results()
-{
- int i = 0;
- for (i = 0; i < test_results_i; i++)
- {
- printf("%s;%s;%s\n", test_results[i].name, test_results[i].result, test_results[i].comment);
- }
+ printf("%s;%s;%s\n", test_id, result, comment);
+ fflush(stdout);
}
int main(int argc, char* argv[])
}
}
- print_results();
return 0;
}