Add an executable wrapper for test_oneliner
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
3e35b2967c
commit
e9463c57b2
6 changed files with 69 additions and 6 deletions
|
@ -58,7 +58,8 @@ set(ddsc_test_sources
|
||||||
"write.c"
|
"write.c"
|
||||||
"write_various_types.c"
|
"write_various_types.c"
|
||||||
"writer.c"
|
"writer.c"
|
||||||
"test_common.c"
|
"test_util.c"
|
||||||
|
"test_util.h"
|
||||||
"test_common.h"
|
"test_common.h"
|
||||||
"test_oneliner.c"
|
"test_oneliner.c"
|
||||||
"test_oneliner.h")
|
"test_oneliner.h")
|
||||||
|
@ -92,3 +93,16 @@ set_tests_properties(
|
||||||
ENVIRONMENT "${CUnit_ddsc_config_simple_udp_env}")
|
ENVIRONMENT "${CUnit_ddsc_config_simple_udp_env}")
|
||||||
|
|
||||||
configure_file("config_env.h.in" "config_env.h" @ONLY)
|
configure_file("config_env.h.in" "config_env.h" @ONLY)
|
||||||
|
|
||||||
|
add_executable(oneliner
|
||||||
|
"oneliner.c"
|
||||||
|
"test_oneliner.c"
|
||||||
|
"test_oneliner.h"
|
||||||
|
"test_util.c"
|
||||||
|
"test_util.h")
|
||||||
|
target_include_directories(
|
||||||
|
oneliner PRIVATE
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src/include/>"
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../ddsc/src>"
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../ddsi/include>")
|
||||||
|
target_link_libraries(oneliner PRIVATE RoundTrip Space ddsc)
|
||||||
|
|
25
src/core/ddsc/tests/oneliner.c
Normal file
25
src/core/ddsc/tests/oneliner.c
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Copyright(c) 2020 ADLINK Technology Limited and others
|
||||||
|
*
|
||||||
|
* This program and the accompanying materials are made available under the
|
||||||
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
||||||
|
* v. 1.0 which is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "test_oneliner.h"
|
||||||
|
|
||||||
|
int main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
for (int i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
if (test_oneliner (argv[i]) <= 0)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -18,10 +18,9 @@
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
|
|
||||||
|
#include "test_util.h"
|
||||||
|
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
|
|
||||||
/* Get unique g_topic name on each invocation. */
|
|
||||||
char *create_unique_topic_name (const char *prefix, char *name, size_t size);
|
|
||||||
|
|
||||||
#endif /* _TEST_COMMON_H_ */
|
#endif /* _TEST_COMMON_H_ */
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
#include "dds/dds.h"
|
#include "dds/dds.h"
|
||||||
|
@ -31,9 +32,12 @@
|
||||||
#include "dds/ddsi/q_xevent.h"
|
#include "dds/ddsi/q_xevent.h"
|
||||||
#include "dds/ddsi/ddsi_entity_index.h"
|
#include "dds/ddsi/ddsi_entity_index.h"
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "test_util.h"
|
||||||
#include "test_oneliner.h"
|
#include "test_oneliner.h"
|
||||||
|
|
||||||
|
#include "Space.h"
|
||||||
|
#include "RoundTrip.h"
|
||||||
|
|
||||||
#define MAXDOMS (sizeof (((struct oneliner_ctx){.result=0}).doms) / sizeof (((struct oneliner_ctx){.result=0}).doms[0]))
|
#define MAXDOMS (sizeof (((struct oneliner_ctx){.result=0}).doms) / sizeof (((struct oneliner_ctx){.result=0}).doms[0]))
|
||||||
|
|
||||||
static const char knownentities[] = "PRWrstwxy";
|
static const char knownentities[] = "PRWrstwxy";
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "dds/ddsrt/atomics.h"
|
#include "dds/ddsrt/atomics.h"
|
||||||
#include "dds/ddsrt/process.h"
|
#include "dds/ddsrt/process.h"
|
||||||
#include "dds/ddsrt/threads.h"
|
#include "dds/ddsrt/threads.h"
|
||||||
#include "test_common.h"
|
#include "test_util.h"
|
||||||
|
|
||||||
char *create_unique_topic_name (const char *prefix, char *name, size_t size)
|
char *create_unique_topic_name (const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
21
src/core/ddsc/tests/test_util.h
Normal file
21
src/core/ddsc/tests/test_util.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Copyright(c) 2020 ADLINK Technology Limited and others
|
||||||
|
*
|
||||||
|
* This program and the accompanying materials are made available under the
|
||||||
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
||||||
|
* v. 1.0 which is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
|
*/
|
||||||
|
#ifndef _TEST_UTIL_H_
|
||||||
|
#define _TEST_UTIL_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/* Get unique g_topic name on each invocation. */
|
||||||
|
char *create_unique_topic_name (const char *prefix, char *name, size_t size);
|
||||||
|
|
||||||
|
#endif /* _TEST_UTIL_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue