Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make test work locally #90

Merged
merged 7 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/pgversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ jobs:
make -j 4
sudo make install

- name: test install
run: |
sudo service postgresql start
sudo -u postgres createdb -p ${PGPORT} ___pgr___test___
sudo -u postgres psql -p ${PGPORT} -d ___pgr___test___ -c "CREATE EXTENSION mobilitydb CASCADE"


- name: Test
run: |
export PATH="/usr/lib/postgresql/${{ matrix.psql }}/bin:$PATH"
cd build
make test
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ else()
message(FATAL_ERROR "Could not find lwgeom;")
endif()

include("test/scripts/test.cmake")
add_subdirectory(test)
include("point/point.cmake")
include("npoint/npoint.cmake")

Expand Down
3 changes: 0 additions & 3 deletions npoint/npoint.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,3 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${SRCNPOINT})

set(SQL "${SQL};${SQLNPOINT}")
set(CONTROLIN "${CONTROLIN};npoint/control.in")

include("npoint/test/scripts/test.cmake")

32 changes: 0 additions & 32 deletions npoint/test/scripts/test.cmake

This file was deleted.

1 change: 0 additions & 1 deletion point/point.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${SRCPOINT})
set(SQL "${SQL};${SQLPOINT}")
set(CONTROLIN "${CONTROLIN};point/control.in")

include("point/test/scripts/test.cmake")
33 changes: 0 additions & 33 deletions point/test/scripts/test.cmake

This file was deleted.

10 changes: 10 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@


add_subdirectory(scripts)
add_subdirectory(general)

if (HAS_LWGEOM)
add_subdirectory(point)
add_subdirectory(npoint)
endif()

36 changes: 36 additions & 0 deletions test/general/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

add_test(
NAME load_tables
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test/scripts
COMMAND test.sh run_passfail load_tables "data/load.sql.xz"
)

set_tests_properties(load_tables PROPERTIES
DEPENDS create_extension
FIXTURES_SETUP DB
RESOURCE_LOCK DBLOCK
FIXTURES_REQUIRED DBEXT)

file(GLOB testfiles "queries/*.sql")
list(SORT testfiles)

foreach(file ${testfiles})
get_filename_component(TESTNAME ${file} NAME_WE)
set(DOTEST TRUE)
if(${TESTNAME} MATCHES "_pg([0-9]+)")
if(${PG_MAJOR_VERSION} LESS ${CMAKE_MATCH_1})
message("Disabling test ${TESTNAME}")
set(DOTEST FALSE)
endif()
endif()
if(DOTEST)
add_test(
NAME ${TESTNAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test/scripts
COMMAND test.sh run_compare ${TESTNAME} ${file}
)
set_tests_properties(${TESTNAME} PROPERTIES
FIXTURES_REQUIRED DB
RESOURCE_LOCK DBLOCK)
endif()
endforeach()
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions test/npoint/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
add_test(
NAME load_npoint_tables
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test/scripts
COMMAND test.sh run_passfail load_npoint_tables "data/load.sql.xz"
)

set_tests_properties(load_npoint_tables PROPERTIES
DEPENDS create_extension
FIXTURES_SETUP DBNPOINT
FIXTURES_REQUIRED DBGEO)

file(GLOB testfiles "queries/*.sql")
list(SORT testfiles)

foreach(file ${testfiles})
get_filename_component(TESTNAME ${file} NAME_WE)
set(DOTEST TRUE)
if(${TESTNAME} MATCHES "_pg([0-9]+)")
if(${PG_MAJOR_VERSION} LESS ${CMAKE_MATCH_1})
message("Disabling test ${TESTNAME}")
set(DOTEST FALSE)
endif()
endif()
if(DOTEST)
add_test(
NAME ${TESTNAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test/scripts
COMMAND test.sh run_compare ${TESTNAME} ${file}
)
set_tests_properties(${TESTNAME} PROPERTIES
FIXTURES_REQUIRED DB
RESOURCE_LOCK DBLOCK)
endif()
endforeach()
File renamed without changes.
35 changes: 35 additions & 0 deletions test/point/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
add_test(
NAME load_geom_tables
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test/scripts
COMMAND test.sh run_passfail load_geom_tables "data/load.sql.xz"
)

set_tests_properties(load_geom_tables PROPERTIES
DEPENDS create_extension
FIXTURES_SETUP DBGEO
FIXTURES_REQUIRED DB)


file(GLOB testfiles "queries/*.sql")
list(SORT testfiles)

foreach(file ${testfiles})
get_filename_component(TESTNAME ${file} NAME_WE)
set(DOTEST TRUE)
if(${TESTNAME} MATCHES "_pg([0-9]+)")
if(${PG_MAJOR_VERSION} LESS ${CMAKE_MATCH_1})
message("Disabling test ${TESTNAME}")
set(DOTEST FALSE)
endif()
endif()
if(DOTEST)
add_test(
NAME ${TESTNAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test/scripts
COMMAND test.sh run_compare ${TESTNAME} ${file}
)
set_tests_properties(${TESTNAME} PROPERTIES
FIXTURES_REQUIRED DB
RESOURCE_LOCK DBLOCK)
endif()
endforeach()
File renamed without changes.
45 changes: 45 additions & 0 deletions test/scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
set(CTEST_PARALLEL_LEVEL 1)

#TODO find xycat (or suitable decompressor)
set(UNCOMPRESS xzcat)

configure_file(test.sh test.sh @ONLY)


add_test(
NAME build
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR}
)

add_test(
NAME setup
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND test.sh setup
)

add_test(
NAME create_extension
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND test.sh create_ext
)

add_test(
NAME teardown
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND test.sh teardown
)

set_tests_properties(setup PROPERTIES
DEPENDS build
FIXTURES_SETUP DBSETUP
RESOURCE_LOCK DBLOCK)

set_tests_properties(create_extension PROPERTIES
DEPENDS setup
FIXTURES_SETUP DBEXT
RESOURCE_LOCK DBLOCK
FIXTURES_REQUIRED DBSETUP)

set_tests_properties(teardown PROPERTIES
FIXTURES_CLEANUP DB;DBEXT;DBSETUP
RESOURCE_LOCK DBLOCK)
64 changes: 0 additions & 64 deletions test/scripts/test.cmake

This file was deleted.

Loading