_acs-tcl__zip_and_unzip (private)
_acs-tcl__zip_and_unzip
Defined in packages/acs-tcl/tcl/test/utilities-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ aa_section "Creating a zip file" set tmpdir [ad_mktmpdir] set wfd [ad_opentmpfile tmpname] puts $wfd ABCD close $wfd set checksum [ns_md file $tmpname] file rename -- $tmpname $tmpdir util::zip -source $tmpdir -destination $tmpdir/test.zip aa_true "Zip '$tmpdir/test.zip' was created" [util::file_content_check -type zip -filename $tmpdir/test.zip] aa_section "Unzipping the file" set tmpdir2 [ad_mktmpdir] util::unzip -source $tmpdir/test.zip -destination $tmpdir2 set tmpname [file tail $tmpname] aa_true "File '$tmpdir2/$tmpname' was created" [file exists $tmpdir2/$tmpname] aa_equals "File content is correct" [ns_md file $tmpdir2/$tmpname] $checksum aa_section "Unzipping on existing content (no overwrite)" aa_log "Write different content in '$tmpdir2/$tmpname'" set wfd [open $tmpdir2/$tmpname w] puts $wfd EFGH close $wfd set checksum2 [ns_md file $tmpdir2/$tmpname] aa_log "Replace '$tmpdir/test.zip' with a new one with both the an existing and a non-existing file" file copy $tmpdir2/$tmpname $tmpdir/second-file.txt util::zip -source $tmpdir -destination $tmpdir/test.zip aa_false "Extracting again the same stuff in the same folder will not fail" [catch { util::unzip -source $tmpdir/test.zip -destination $tmpdir2 }] aa_equals "File '$tmpdir2/$tmpname' was NOT overwritten" [ns_md file $tmpdir2/$tmpname] $checksum2 aa_equals "File '$tmpdir2/second-file.txt' was extracted correctly" [ns_md file $tmpdir2/second-file.txt] $checksum2 aa_section "Unzipping on existing content (overwrite)" aa_false "Extracting again the same stuff in the same folder will not fail" [catch { util::unzip -overwrite -source $tmpdir/test.zip -destination $tmpdir2 }] aa_equals "File '$tmpdir2/$tmpname' was overwritten as expected with the file from the zip" [ns_md file $tmpdir2/$tmpname] $checksum aa_equals "File '$tmpdir2/second-file.txt' was extracted correctly" [ns_md file $tmpdir2/second-file.txt] $checksum2 file delete -force $tmpdir file delete -force $tmpdir2 }} { aa_log "Running testcase body $body_count" set ::__aa_test_indent [info level] set catch_val [catch $testcase_body msg] if {$catch_val != 0 && $catch_val != 2} { aa_log_result "fail" "zip_and_unzip (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle