Skip to content

Commit 40f95f4

Browse files
committed
Fix windows ut regarding sql.properties file.
1 parent 145e63e commit 40f95f4

File tree

4 files changed

+57
-54
lines changed

4 files changed

+57
-54
lines changed

test/CJUnitTestsPort/BaseTestFixture.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ int TestFixtureCommon::instanceCount=1;
4343

4444
Properties TestFixtureCommon::sqlProps;
4545

46-
int TestFixtureCommon::propsLoaded=resources::LoadProperties(SQL_PROPERTIES_FILE
47-
, sqlProps
48-
, NULL);
46+
static const char * possiblePropertiesLocations[]={".."
47+
, "test/CJUnitTestsPort"
48+
, NULL //last should be NULL
49+
};
50+
51+
int TestFixtureCommon::propsLoaded=resources::LoadProperties("sql.properties",
52+
sqlProps,
53+
possiblePropertiesLocations);
4954

5055
Driver * TestFixtureCommon::driver=NULL;
5156

test/CJUnitTestsPort/CMakeLists.txt

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,93 @@
11
#
2-
# Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
33
#
44
# The MySQL Connector/C++ is licensed under the terms of the GPLv2
55
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
66
# MySQL Connectors. There are special exceptions to the terms and
77
# conditions of the GPLv2 as it is applied to this software, see the
88
# FLOSS License Exception
99
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
10-
#
10+
#
1111
# This program is free software; you can redistribute it and/or modify
1212
# it under the terms of the GNU General Public License as published
1313
# by the Free Software Foundation; version 2 of the License.
14-
#
14+
#
1515
# This program is distributed in the hope that it will be useful, but
1616
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1717
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1818
# for more details.
19-
#
19+
#
2020
# You should have received a copy of the GNU General Public License along
2121
# with this program; if not, write to the Free Software Foundation, Inc.,
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323
#
2424

2525
IF(WIN32)
26-
LINK_DIRECTORIES(../framework/$(ConfigurationName))
27-
SET(MY_TARGET_LINK_LIBRARIES mysqlcppconn test_framework)
26+
LINK_DIRECTORIES(../framework/$(ConfigurationName))
27+
SET(MY_TARGET_LINK_LIBRARIES mysqlcppconn test_framework)
2828
# ADD_DEFINITIONS("-D_SECURE_SCL")
29-
ADD_DEFINITIONS("-D_SCL_SECURE_NO_WARNINGS")
30-
ADD_DEFINITIONS("-D_CRT_SECURE_NO_WARNINGS")
29+
ADD_DEFINITIONS("-D_SCL_SECURE_NO_WARNINGS")
30+
ADD_DEFINITIONS("-D_CRT_SECURE_NO_WARNINGS")
3131

3232
ELSEIF(NOT WIN32)
33-
SET(MY_TARGET_LINK_LIBRARIES mysqlcppconn test_framework)
33+
SET(MY_TARGET_LINK_LIBRARIES mysqlcppconn test_framework)
3434
ENDIF(WIN32)
3535

3636
IF(CMAKE_COMPILER_IS_GNUCC AND MYSQLCPPCONN_GCOV_ENABLE)
37-
SET(MY_GCOV_LINK_LIBRARIES gcov)
37+
SET(MY_GCOV_LINK_LIBRARIES gcov)
3838
ENDIF(CMAKE_COMPILER_IS_GNUCC AND MYSQLCPPCONN_GCOV_ENABLE)
3939

4040
ADD_DEFINITIONS("-DWE_HAVE_DATATYPE_AGAIN")
4141

4242
IF(MYSQLCPPCONN_TEST_NOT_IMPLEMENTED)
43-
ADD_DEFINITIONS("-DINCLUDE_NOT_IMPLEMENTED_METHODS=1")
43+
ADD_DEFINITIONS("-DINCLUDE_NOT_IMPLEMENTED_METHODS=1")
4444
ENDIF(MYSQLCPPCONN_TEST_NOT_IMPLEMENTED)
4545

4646
SET(jdbctests_sources
47-
ccpptests.cpp
48-
BaseTestFixture.cpp
49-
../common/stringutils.cpp
50-
resources.cpp
51-
regression/EscapeProcessorRegressionTest.cpp
52-
compliance/ConnectionTest.cpp
53-
compliance/DatabaseMetaDataTest.cpp
54-
compliance/StatementTest.cpp
55-
compliance/ResultSetMetadataTest.cpp
56-
compliance/PreparedStatementTest.cpp
57-
simple/BlobTest.cpp
58-
regression/BlobRegressionTest.cpp
59-
regression/PreparedStatementRegressionTest.cpp
60-
simple/TransactionTest.cpp
61-
regression/SubqueriesRegressionTest.cpp
62-
compliance/UnbufferedRsStmtTest.cpp
63-
)
47+
ccpptests.cpp
48+
BaseTestFixture.cpp
49+
../common/stringutils.cpp
50+
resources.cpp
51+
regression/EscapeProcessorRegressionTest.cpp
52+
compliance/ConnectionTest.cpp
53+
compliance/DatabaseMetaDataTest.cpp
54+
compliance/StatementTest.cpp
55+
compliance/ResultSetMetadataTest.cpp
56+
compliance/PreparedStatementTest.cpp
57+
simple/BlobTest.cpp
58+
regression/BlobRegressionTest.cpp
59+
regression/PreparedStatementRegressionTest.cpp
60+
simple/TransactionTest.cpp
61+
regression/SubqueriesRegressionTest.cpp
62+
compliance/UnbufferedRsStmtTest.cpp
63+
)
6464

6565
# It's convinient for VS users to have headers as part of project
6666
IF(WIN32)
67-
SET(jdbctests_sources
68-
${jdbctests_sources}
69-
BaseTestFixture.h
70-
../common/stringutils.h
71-
resources.h
72-
regression/EscapeProcessorRegressionTest.h
73-
compliance/ConnectionTest.h
74-
compliance/DatabaseMetaDataTest.h
75-
compliance/StatementTest.h
76-
compliance/ResultSetMetadataTest.h
77-
compliance/PreparedStatementTest.h
78-
simple/BlobTest.h
79-
regression/BlobRegressionTest.h
80-
regression/PreparedStatementRegressionTest.h
81-
simple/TransactionTest.h
82-
regression/SubqueriesRegressionTest.h
83-
compliance/UnbufferedRsStmtTest.h
84-
)
67+
SET(jdbctests_sources
68+
${jdbctests_sources}
69+
BaseTestFixture.h
70+
../common/stringutils.h
71+
resources.h
72+
regression/EscapeProcessorRegressionTest.h
73+
compliance/ConnectionTest.h
74+
compliance/DatabaseMetaDataTest.h
75+
compliance/StatementTest.h
76+
compliance/ResultSetMetadataTest.h
77+
compliance/PreparedStatementTest.h
78+
simple/BlobTest.h
79+
regression/BlobRegressionTest.h
80+
regression/PreparedStatementRegressionTest.h
81+
simple/TransactionTest.h
82+
regression/SubqueriesRegressionTest.h
83+
compliance/UnbufferedRsStmtTest.h
84+
)
8585
ENDIF(WIN32)
8686

8787
ADD_EXECUTABLE(CJUnitTestsPort ${jdbctests_sources})
8888
TARGET_LINK_LIBRARIES(CJUnitTestsPort ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES})
8989

90+
#Copy sql.properties file to build dir
91+
file(COPY sql.properties DESTINATION ${CMAKE_BINARY_DIR}/test/CJUnitTestsPort/)
92+
9093
MESSAGE(STATUS "Configuring C/J junit tests port")

test/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ SET(TEST_DEFAULT_DB "test" CACHE STRING "Defines Unit Tests
3030
SET(TEST_DEFAULT_LOGIN "root" CACHE STRING "Defines Unit Tests default login user" )
3131
SET(TEST_DEFAULT_PASSWD "root" CACHE STRING "Defines Unit Tests default login user password" )
3232

33-
# sql.properties file for CJUnitTestsPort tests
34-
set(SQL_PROPERTIES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CJUnitTestsPort/sql.properties")
3533

3634
configure_file(tests_config.h.in
3735
${CMAKE_BINARY_DIR}/tests_config.h)

test/tests_config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
3030
#define TEST_DEFAULT_LOGIN "${TEST_DEFAULT_LOGIN}"
3131
#define TEST_DEFAULT_PASSWD "${TEST_DEFAULT_PASSWD}"
3232

33-
#define SQL_PROPERTIES_FILE "${SQL_PROPERTIES_FILE}"
34-
35-
3633
#endif //_TESTS_CONFIG_IN_

0 commit comments

Comments
 (0)