@@ -158,6 +158,23 @@ function main() {
158158 printf -- ' %s' " ${testResultString} "
159159 } # getTestResultColorizedString
160160
161+ function convertToWindowsPath() {
162+ local originalUnixPath=" $1 "
163+ local unixPath=" ${originalUnixPath} "
164+ local windowsPath
165+
166+ # Convert drive letter
167+ if [[ " ${unixPath: 0: 1} " == ' /' ]]; then
168+ windowsPath=" ${unixPath: 1: 1} :\\ "
169+
170+ unixPath=" ${unixPath: 3} "
171+ fi
172+
173+ windowsPath=" ${windowsPath} $( printf -- ' %s' " ${unixPath} " | sed ' s|/|\\|g' ) "
174+
175+ printf -- ' %s\n' " ${windowsPath} "
176+ } # convertToWindowsPath
177+
161178 function executeUnitTest() {
162179 local testType=" $1 "
163180 local testFile=" $2 "
@@ -174,6 +191,10 @@ function main() {
174191 local resultFile
175192 local logFile
176193 local wrapperFile
194+ local nologParam
195+ local testFileOS
196+ local testFilenameOS
197+ local testDirectoryOS
177198
178199 testDirectory=" $( dirname " ${testFile} " ) "
179200 testFilename=" $( basename " ${testFile} " ) "
@@ -182,6 +203,23 @@ function main() {
182203
183204 cd " ${testDirectory} " || return 1
184205
206+ # Determine cross-os specific variables needed for execute
207+ if [[ " ${OSTYPE} " == " cygwin" || " ${OSTYPE} " == " msys" || " ${OSTYPE} " == " win32" ]]; then
208+ # Handle Windows systems
209+ nologParam=" //nolog"
210+
211+ testFileOS=" $( convertToWindowsPath " ${testFile} " ) "
212+ testDirectoryOS=" $( convertToWindowsPath " ${testDirectory} " ) "
213+ testFilenameOS=" $( convertToWindowsPath " ${testFilename} " ) "
214+ else
215+ # Handle linux/unix based systems
216+ nologParam=" /nolog"
217+
218+ testFileOS=" ${testFile} "
219+ testDirectoryOS=" ${testDirectory} "
220+ testFilenameOS=" ${testFilename} "
221+ fi
222+
185223 # Make sure SQLPATH is not set for SQLcl execution so no login.sql
186224 # script is runs
187225 export SQLPATH=" "
@@ -202,7 +240,7 @@ function main() {
202240 set verify on
203241 set echo on
204242 show connection
205- @ "${testFile } " "${functionUniqueIdentifier} " "${testDirectory } "
243+ @ "${testFileOS } " "${functionUniqueIdentifier} " "${testDirectoryOS } "
206244 EOF
207245 testResultCode=$?
208246
@@ -223,10 +261,10 @@ function main() {
223261 printf -- ' set verify on\n'
224262 printf -- ' set echo on\n'
225263 printf -- ' show connection\n'
226- printf -- ' @ "%s" "%s" "%s"' " ${testFile } " " ${functionUniqueIdentifier} " " ${testDirectory } "
264+ printf -- ' @ "%s" "%s" "%s"' " ${testFileOS } " " ${functionUniqueIdentifier} " " ${testDirectoryOS } "
227265 } > " ${wrapperFile} "
228266
229- " ${sqlclBinary} " -noupdates /nolog " @${wrapperFile} " 1>> " ${logFile} " 2>&1
267+ " ${sqlclBinary} " -noupdates " ${nologParam} " " @${wrapperFile} " 1>> " ${logFile} " 2>&1
230268 testResultCode=$?
231269
232270 rm " ${wrapperFile} "
@@ -247,7 +285,7 @@ function main() {
247285 set verify on
248286 set echo on
249287 show connection
250- liquibase update -contexts test_context -database-changelog-table-name ${databaseChangelogTableName} -changelog-file ${testFilename }
288+ liquibase update -contexts test_context -database-changelog-table-name ${databaseChangelogTableName} -changelog-file ${testFilenameOS }
251289 EOF
252290 testResultCode=$?
253291 elif [[ " ${testType} " = " ${testTypeSqlclLiquibaseSearchPath} " ]]; then
@@ -265,7 +303,7 @@ function main() {
265303 set verify on
266304 set echo on
267305 show connection
268- liquibase update -contexts test_context -database-changelog-table-name ${databaseChangelogTableName} -search-path ${testDirectory } -changelog-file ${testFilename }
306+ liquibase update -contexts test_context -database-changelog-table-name ${databaseChangelogTableName} -search-path ${testDirectoryOS } -changelog-file ${testFilenameOS }
269307 EOF
270308 testResultCode=$?
271309 fi
@@ -606,8 +644,8 @@ function main() {
606644 printf -- ' \n' | tee -a " ${logMainFile} "
607645 fi
608646
609- sqlParamsWithoutPassword+=(" -user" " ${databaseUsername} " " -url" " ${databaseConnectIdentifier} " )
610- sqlParamsWithPassword+=(" ${sqlParamsWithoutPassword[@]} " " -password" " ${databasePassword} " )
647+ sqlParamsWithoutPassword+=(" -user" " \" ${databaseUsername} \" " " -url" " \" ${databaseConnectIdentifier} \" " )
648+ sqlParamsWithPassword+=(" ${sqlParamsWithoutPassword[@]} " " -password" " \" ${databasePassword} \" " )
611649
612650 if ! " ${sqlclBinary} " " ${sqlParamsDirectConnect[@]} " " ${sqlParamsWithPassword[@]} " 1>> " ${logMainFile} " 2>&1 << - EOF
613651 show connection
0 commit comments