From 574c3c0027c42be176a63ca592ce16f1c2bab151 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 27 Jun 2019 16:20:05 +0000 Subject: winFCmd.test: fixes EXDEV related constraint and paths in test cases (covering move/rename across devices) --- tests/winFCmd.test | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/tests/winFCmd.test b/tests/winFCmd.test index 5243eca..f3334e2 100644 --- a/tests/winFCmd.test +++ b/tests/winFCmd.test @@ -97,8 +97,13 @@ if {[testConstraint testvolumetype]} { # NB: filename is chosen to be short but unlikely to clash with other apps if {[file exists c:/] && [file exists d:/]} { catch {file delete d:/TclTmpF.1} - if {[catch {createfile d:/TclTmpF.1 {}}] == 0} { - file delete d:/TclTmpF.1 + catch {file delete d:/TclTmpD.1} + catch {file delete c:/TclTmpC.1} + if {![catch {createfile d:/TclTmpF.1 {}}] && [file isfile d:/TclTmpF.1] + && ![catch {file mkdir d:/TclTmpD.1}] && [file isdirectory d:/TclTmpD.1] + && ![catch {file mkdir c:/TclTmpC.1}] && [file isdirectory c:/TclTmpC.1] + } { + file delete d:/TclTmpF.1 d:/TclTmpD.1 c:/TclTmpC.1 testConstraint exdev 1 } } @@ -178,12 +183,12 @@ test winFCmd-1.9 {TclpRenameFile: errno: ENOTDIR} -setup { testfile mv td1 tf1 } -returnCodes error -result ENOTDIR test winFCmd-1.10 {TclpRenameFile: errno: EXDEV} -setup { - file delete -force d:/tf1 + file delete -force d:/TclTmpD.1 } -constraints {win exdev testfile} -body { - file mkdir c:/tf1 - testfile mv c:/tf1 d:/tf1 + file mkdir c:/TclTmpC.1 + testfile mv c:/TclTmpC.1 d:/TclTmpD.1 } -cleanup { - file delete -force c:/tf1 + file delete -force c:/TclTmpC.1 } -returnCodes error -result EXDEV test winFCmd-1.11 {TclpRenameFile: errno: EACCES} -setup { cleanup @@ -333,15 +338,15 @@ test winFCmd-1.32 {TclpRenameFile: TclpRemoveDirectory succeeds} -setup { } -result {0 1 1} test winFCmd-1.33 {TclpRenameFile: After removing dst dir, MoveFile fails} \ -constraints {win exdev testfile testchmod} -body { - file mkdir d:/td1 - testchmod 0 d:/td1 - file mkdir c:/tf1 - catch {testfile mv c:/tf1 d:/td1} msg - list $msg [file writable d:/td1] -} -cleanup { - catch {testchmod 0o666 d:/td1} - file delete d:/td1 - file delete -force c:/tf1 + file mkdir d:/TclTmpD.1 + testchmod 0 d:/TclTmpD.1 + file mkdir c:/TclTmpC.1 + catch {testfile mv c:/TclTmpC.1 d:/TclTmpD.1} msg + list $msg [file writable d:/TclTmpD.1] +} -cleanup { + catch {testchmod 0o666 d:/TclTmpD.1} + file delete d:/TclTmpD.1 + file delete -force c:/TclTmpC.1 } -result {EXDEV 0} test winFCmd-1.34 {TclpRenameFile: src is dir, dst is not} -setup { cleanup @@ -1070,13 +1075,13 @@ test winFCmd-12.5 {ConvertFileNameFormat: absolute path} -body { list [file attributes / -longname] [file attributes \\ -longname] } -constraints {win} -result {/ /} test winFCmd-12.6 {ConvertFileNameFormat: absolute path with drive} -setup { - catch {file delete -force -- c:/td1} + catch {file delete -force -- c:/TclTmpC.1} } -constraints {win win2000orXP} -body { - createfile c:/td1 {} - string tolower [file attributes c:/td1 -longname] + createfile c:/TclTmpC.1 {} + string tolower [file attributes c:/TclTmpC.1 -longname] } -cleanup { - file delete -force -- c:/td1 -} -result {c:/td1} + file delete -force -- c:/TclTmpC.1 +} -result [string tolower {c:/TclTmpC.1}] test winFCmd-12.6.2 {ConvertFileNameFormat: absolute path with drive (in temp folder)} -setup { catch {file delete -force -- $::env(TEMP)/td1} } -constraints {win} -body { -- cgit v0.12