Skip to content

Commit

Permalink
MacOS tests
Browse files Browse the repository at this point in the history
Summary: MacOS tests

Test Plan: https://app.circleci.com/pipelines/github/memsql/singlestore-odbc-connector/1657/workflows/bd12bbb9-77c6-4594-8805-d4e9419bbf63

Reviewers: amakarovych-ua, dPoltorak-ua

Reviewed By: dPoltorak-ua

Subscribers: engineering-list

Differential Revision: https://grizzly.internal.memcompute.com/D49964
  • Loading branch information
blinov-ivan committed Jul 27, 2021
1 parent 619690c commit 16abd28
Show file tree
Hide file tree
Showing 26 changed files with 180 additions and 149 deletions.
4 changes: 2 additions & 2 deletions .run/odbc_blob.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="odbc_blob" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_blob" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_blob">
<configuration default="false" name="odbc_blob" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_blob" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_blob">
<envs>
<env name="ODBCINI" value="./test/odbc.ini" />
<env name="ODBCSYSINI" value="./test" />
<env name="ODBCINSTINI" value="./test/odbcinst.ini" />
</envs>
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
Expand Down
4 changes: 2 additions & 2 deletions .run/odbc_bulk.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="odbc_bulk" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_bulk" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_bulk">
<configuration default="false" name="odbc_bulk" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_bulk" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_bulk">
<envs>
<env name="ODBCINI" value="./test/odbc.ini" />
<env name="ODBCSYSINI" value="./test" />
<env name="ODBCINSTINI" value="./test/odbcinst.ini" />
</envs>
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
Expand Down
4 changes: 2 additions & 2 deletions .run/odbc_client_side.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="odbc_client_side" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_client_side" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_client_side">
<configuration default="false" name="odbc_client_side" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_client_side" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_client_side">
<envs>
<env name="ODBCINI" value="./test/odbc.ini" />
<env name="ODBCSYSINI" value="./test" />
<env name="ODBCINSTINI" value="./test/odbcinst.ini" />
</envs>
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
Expand Down
4 changes: 2 additions & 2 deletions .run/odbc_error.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="odbc_error" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_error" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_error">
<configuration default="false" name="odbc_error" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_error" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_error">
<envs>
<env name="ODBCINI" value="./test/odbc.ini" />
<env name="ODBCSYSINI" value="./test" />
<env name="ODBCINSTINI" value="./test/odbcinst.ini" />
</envs>
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
Expand Down
4 changes: 2 additions & 2 deletions .run/odbc_escape_sequences.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="odbc_escape_sequences" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_escape_sequences" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_escape_sequences">
<configuration default="false" name="odbc_escape_sequences" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_escape_sequences" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_escape_sequences">
<envs>
<env name="ODBCINI" value="./test/odbc.ini" />
<env name="ODBCSYSINI" value="./test" />
<env name="ODBCINSTINI" value="./test/odbcinst.ini" />
</envs>
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
Expand Down
6 changes: 3 additions & 3 deletions .run/odbc_sql_buffers.run.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="odbc_sql_buffers" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_sql_buffers" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_sql_buffers">
<configuration default="false" name="odbc_sql_buffers" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_sql_buffers" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_sql_buffers">
<envs>
<env name="ODBCINI" value="./test/odbc.ini" />
<env name="ODBCSYSINI" value="./test" />
<env name="ODBCINSTINI" value="./test/odbcinst.ini" />
</envs>
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>
</component>
4 changes: 2 additions & 2 deletions .run/odbc_sql_get_diag_field.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="odbc_sql_get_diag_field" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_sql_get_diag_field" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_sql_get_diag_field">
<configuration default="false" name="odbc_sql_get_diag_field" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_sql_get_diag_field" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_sql_get_diag_field">
<envs>
<env name="ODBCINI" value="./test/odbc.ini" />
<env name="ODBCSYSINI" value="./test" />
<env name="ODBCINSTINI" value="./test/odbcinst.ini" />
</envs>
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
Expand Down
4 changes: 2 additions & 2 deletions .run/odbc_sql_get_functions.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="odbc_sql_get_functions" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_sql_get_functions" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_sql_get_functions">
<configuration default="false" name="odbc_sql_get_functions" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_sql_get_functions" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_sql_get_functions">
<envs>
<env name="ODBCINI" value="./test/odbc.ini" />
<env name="ODBCSYSINI" value="./test" />
<env name="ODBCINSTINI" value="./test/odbcinst.ini" />
</envs>
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
Expand Down
4 changes: 2 additions & 2 deletions .run/odbc_sql_procedure_columns.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="odbc_sql_procedure_columns" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_sql_procedure_columns" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_sql_procedure_columns">
<configuration default="false" name="odbc_sql_procedure_columns" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$CMakeCurrentGenerationDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="singlestore_connector_odbc" TARGET_NAME="odbc_sql_procedure_columns" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="singlestore_connector_odbc" RUN_TARGET_NAME="odbc_sql_procedure_columns">
<envs>
<env name="ODBCINI" value="./test/odbc.ini" />
<env name="ODBCSYSINI" value="./test" />
<env name="ODBCINSTINI" value="./test/odbcinst.ini" />
</envs>
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ IF (WITH_SANITIZER)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fsanitize=leak -fsanitize=address")
ENDIF(WITH_SANITIZER)

IF(APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration")
ENDIF(APPLE)

# We need to determine the last parameter for SQLColAttribute:
# Older UnixODBC version expect SQLPOINTER while Windows expects SQLLEN *
Expand Down
1 change: 1 addition & 0 deletions cmake/FindIconv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ IF(APPLE)
find_library(ICONV_LIBRARIES NAMES iconv libiconv c PATHS
/opt/local/lib/
/usr/lib/
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/
NO_CMAKE_SYSTEM_PATH)
SET(ICONV_EXTERNAL TRUE)
ELSE()
Expand Down
4 changes: 4 additions & 0 deletions ma_ansi.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ SQLRETURN SQL_API SQLNativeSql(SQLHDBC ConnectionHandle,
MADB_SetError(&Dbc->Error, MADB_ERR_01004, NULL, 0);
return Dbc->Error.ReturnValue;
}
if ((TextLength1 < 0 && TextLength1 != SQL_NTS) || (BufferLength < 0 && OutStatementText != NULL)) {
MADB_SetError(&Dbc->Error, MADB_ERR_HY090, NULL, 0);
return Dbc->Error.ReturnValue;
}

InStatementStart = (char *)InStatementText;
ADJUST_LENGTH(InStatementStart, TextLength1);
Expand Down
9 changes: 5 additions & 4 deletions ma_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,25 +899,26 @@ SQLRETURN MADB_DbcGetFunctions(MADB_Dbc *Dbc, SQLUSMALLINT FunctionId, SQLUSMALL
SQLUSMALLINT function= MADB_supported_api[i];
SupportedPtr[function >> 4]|= (1 << (function & 0x000F));
}
break;
return SQL_SUCCESS;
case SQL_API_ALL_FUNCTIONS:
/* Set all to SQL_FALSE (0) */
memset(SupportedPtr, 0, sizeof(SQLUSMALLINT) * 100);
for (i=0; i < Elements; i++)
if (MADB_supported_api[i] < 100)
SupportedPtr[MADB_supported_api[i]]= SQL_TRUE;
break;
return SQL_SUCCESS;
default:
*SupportedPtr= SQL_FALSE;
for (i=0; i < Elements; i++)
if (MADB_supported_api[i] == FunctionId)
{
*SupportedPtr= SQL_TRUE;
break;
return SQL_SUCCESS;
}
break;
}
return SQL_SUCCESS;
return MADB_SetError(&Dbc->Error, MADB_ERR_HY095, "Function type out of range",
mysql_errno(Dbc->mariadb));
}
/* }}} */

Expand Down
3 changes: 1 addition & 2 deletions ma_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ SQLRETURN MADB_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
// TODO PLAT-5589
break;
case SQL_DIAG_NUMBER:
*(SQLINTEGER *)DiagInfoPtr= (Err->ReturnValue == SQL_SUCCESS) ? 0:1;
*(SQLINTEGER *)DiagInfoPtr= (Err->ReturnValue == SQL_SUCCESS) ? 0 : 1;
break;
case SQL_DIAG_RETURNCODE:
*(SQLRETURN *)DiagInfoPtr= Err->ReturnValue;
Expand Down Expand Up @@ -441,7 +441,6 @@ SQLRETURN MADB_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
isWChar ? BufferLength / sizeof(SQLWCHAR) : BufferLength, Err->SqlState, strlen(Err->SqlState), &Error);
if (StringLengthPtr)
*StringLengthPtr= (SQLSMALLINT)Length;

break;
case SQL_DIAG_SUBCLASS_ORIGIN:
if (BufferLength < 0)
Expand Down
1 change: 0 additions & 1 deletion ma_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ SQLLEN SafeStrlen(SQLCHAR *str, SQLLEN buff_length);
#define IDENTIFIER_BUFFER_OVERHEAD 3
my_bool ProcessIdentifierString(INOUT char* out, const char* in, const size_t len);


/* Calculate string length (if needed) and check for some input error
*
* ptr should be a string without zero chars inside
Expand Down
4 changes: 4 additions & 0 deletions ma_unicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,10 @@ SQLRETURN SQL_API SQLNativeSqlW(SQLHDBC ConnectionHandle,
MADB_SetError(&Dbc->Error, MADB_ERR_01004, NULL, 0);
return Dbc->Error.ReturnValue;
}
if ((TextLength1 < 0 && TextLength1 != SQL_NTS) || (BufferLength < 0 && OutStatementText != NULL)) {
MADB_SetError(&Dbc->Error, MADB_ERR_HY090, NULL, 0);
return Dbc->Error.ReturnValue;
}

InStmtStr= MADB_ConvertFromWChar(InStatementText, TextLength1, &InLength, Dbc->ConnOrSrcCharset, &ConversionError);
if (ConversionError)
Expand Down
4 changes: 3 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ IF(NOT WIN32)
ENDIF()
# iOdbc has
IF(WITH_IODBC)
SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-Wno-pointer-sign")
# Doesn't work with newer Clang
# -Wno-pointer-sign: command not found
# SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-Wno-pointer-sign")
ENDIF()
FOREACH (ODBC_TEST ${ODBC_TESTS})
IF (${ODBC_TEST} STREQUAL "interactive")
Expand Down
Loading

0 comments on commit 16abd28

Please sign in to comment.