0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Use Python3 for test_scripts (#298)

* Use Python3 for test_scripts
* Update travis and cmake
This commit is contained in:
Uy Ha 2019-10-14 12:09:18 +02:00 committed by Roland Bock
parent bb77cc1459
commit c021c49b0b
2 changed files with 9 additions and 8 deletions

View File

@ -4,7 +4,7 @@ os:
- linux - linux
- osx - osx
dist: trusty dist: xenial
sudo: required sudo: required
compiler: compiler:
@ -23,6 +23,7 @@ notifications:
install: install:
- g++ --version - g++ --version
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew upgrade cmake; fi
- cmake --version - cmake --version
- git clone https://github.com/HowardHinnant/date - git clone https://github.com/HowardHinnant/date
- cd date - cd date

View File

@ -22,11 +22,11 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include(FindPythonInterp) include(FindPython3)
if (${PYTHONINTERP_FOUND}) if (${Python3_Interpreter_FOUND})
execute_process( execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import pyparsing" COMMAND ${Python3_EXECUTABLE} -c "import pyparsing"
RESULT_VARIABLE PythonRESULT RESULT_VARIABLE PythonRESULT
OUTPUT_VARIABLE PythonOUTPUT OUTPUT_VARIABLE PythonOUTPUT
ERROR_VARIABLE PythonERROR ERROR_VARIABLE PythonERROR
@ -39,21 +39,21 @@ if (${PYTHONINTERP_FOUND})
message(STATUS "Pyparsing is installed: Enabling ddl2cpp tests.") message(STATUS "Pyparsing is installed: Enabling ddl2cpp tests.")
add_test(NAME sqlpp11.test.ddl2cpp.bad_will_fail add_test(NAME sqlpp11.test.ddl2cpp.bad_will_fail
COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql"
"${CMAKE_CURRENT_BINARY_DIR}/fail" "${CMAKE_CURRENT_BINARY_DIR}/fail"
test) test)
set_tests_properties(sqlpp11.test.ddl2cpp.bad_will_fail PROPERTIES WILL_FAIL 1) set_tests_properties(sqlpp11.test.ddl2cpp.bad_will_fail PROPERTIES WILL_FAIL 1)
add_test(NAME sqlpp11.test.ddl2cpp.bad_has_parse_error add_test(NAME sqlpp11.test.ddl2cpp.bad_has_parse_error
COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql"
"${CMAKE_CURRENT_BINARY_DIR}/fail" "${CMAKE_CURRENT_BINARY_DIR}/fail"
test) test)
set_tests_properties(sqlpp11.test.ddl2cpp.bad_has_parse_error PROPERTIES PASS_REGULAR_EXPRESSION "Parsing error,.*") set_tests_properties(sqlpp11.test.ddl2cpp.bad_has_parse_error PROPERTIES PASS_REGULAR_EXPRESSION "Parsing error,.*")
add_test(NAME sqlpp11.test.ddl2cpp.good_succeeds add_test(NAME sqlpp11.test.ddl2cpp.good_succeeds
COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql"
"${CMAKE_CURRENT_BINARY_DIR}/fail" "${CMAKE_CURRENT_BINARY_DIR}/fail"
test) test)
@ -67,7 +67,7 @@ if (${PYTHONINTERP_FOUND})
endif() endif()
add_custom_command( add_custom_command(
OUTPUT "${sqlpp.test.generated.sample.include}.h" OUTPUT "${sqlpp.test.generated.sample.include}.h"
COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp"
${use_identity_naming} ${use_identity_naming}
"${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql"
"${sqlpp.test.generated.sample.include}" "${sqlpp.test.generated.sample.include}"