Skip to content

Commit

Permalink
defncopy: Add test for the applications
Browse files Browse the repository at this point in the history
Use commands calling programs.
Mainly use tsql to create some table, output definition with
defncopy and check definition is as expected.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
  • Loading branch information
freddy77 committed Mar 31, 2024
1 parent 5ad8d29 commit 3585d56
Show file tree
Hide file tree
Showing 6 changed files with 461 additions and 1 deletion.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@ AC_CONFIG_FILES(include/freetds/version.h \
src/odbc/unittests/Makefile \
src/apps/Makefile \
src/apps/fisql/Makefile \
src/apps/unittests/Makefile \
freetds.spec \
win32/Makefile \
win32/freetds.nsh \
Expand Down
2 changes: 2 additions & 0 deletions src/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
add_subdirectory(unittests)

set(libs ${lib_NETWORK} ${lib_BASE})

foreach(target freebcp bsqldb defncopy datacopy)
Expand Down
2 changes: 1 addition & 1 deletion src/apps/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AM_CPPFLAGS = -I$(top_srcdir)/include

SUBDIRS = fisql
SUBDIRS = fisql . unittests

DIST_SUBDIRS = $(SUBDIRS)

Expand Down
9 changes: 9 additions & 0 deletions src/apps/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include_directories(..)

foreach(target defncopy)
add_executable(a_${target} EXCLUDE_FROM_ALL ${target}.c)
set_target_properties(a_${target} PROPERTIES OUTPUT_NAME ${target})
target_link_libraries(a_${target} replacements tdsutils ${lib_NETWORK} ${lib_BASE})
add_test(NAME a_${target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND a_${target})
add_dependencies(check a_${target})
endforeach(target)
13 changes: 13 additions & 0 deletions src/apps/unittests/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
NULL=
TESTS = \
defncopy$(EXEEXT) \
$(NULL)

check_PROGRAMS = $(TESTS)

defncopy_SOURCES = defncopy.c

AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir)/.. -I../ -DFREETDS_TOPDIR=\"$(top_srcdir)\"
LDADD = ../../replacements/libreplacements.la $(LTLIBICONV) $(NETWORK_LIBS)
EXTRA_DIST = CMakeLists.txt

Loading

0 comments on commit 3585d56

Please sign in to comment.