Some enhancements to the zosfile unit - #643
Conversation
aafcea3 to
61094e5
Compare
|
Can you turn the "hints for testing" into tests that are part of this PR. The scripts should go in a subdir of zowe-common-c/tests that you create and one script should build the directory structure that can reproduce the problem, another can compile a tiny program to run the test. That would allow me show that the bug existed and was cleared by this fix by running the test in a local repo that does NOT have this fix in it yet. |
|
After seeing your proposal to convert "hints for testing" into actual test cases, I’ve been wondering: since you are already building a ZSS-based regression testing framework, do we still need unit tests? Assuming for a moment that we do need unit tests, could they also be structured as a framework? Here is the concept:
This is just a concept for now, and I’m not yet certain if implementation is necessary, but I believe it is technically feasible. |
Status of this PR: I am creating the test requested by Joe. It will be ready this week. |
|
@JoeNemo Per your request, a runnable unit test program is added into the This PR contains many updates and corrections to the
|
dd01387 to
3bbe83f
Compare
|
Re-tested the current head (2432356) on z/OS (Marist):
Two things stand between this and a merge:
|
JoeNemo
left a comment
There was a problem hiding this comment.
There are zowelog lines in zosfiles directoryClose() that duplicate "returnValue". Looks like a typo.
- Aligns the handling of symbolic links with system commands - Extracts the directory traversal code into shared functions Signed-off-by: ch.zhou <chong.zhou@broadcom.com>
Signed-off-by: ch.zhou <chong.zhou@broadcom.com>
Signed-off-by: ch.zhou <chong.zhou@broadcom.com>
c5eb9e0 to
2f79d7a
Compare
|
|
@JoeNemo Thanks for the feedbacks. The conflicts is resolved (I rebased on the latest 3.x/staging and resolved conflicts). The redundant returnValue is removed. |




Purpose of the PR
This is an extension (a super set) of the old unmerged PR #633 . The old one was closed.
The previous PR aligned the
directoryDeleteRecursive()function with the system commandrm -rfwith regards to the handling of symbolic links.After that, I noticed that the
directoryCopy()function has the same issue about symbolic links.The issue can be summarized as follows: when deleting or copying a directory, symbolic links within the source directory should be unlinked or recreated in the target directory, rather than deleting or copying the files or directories to which those links point.
This PR fixes the inconsistant behavior of the previous implementation.
Additionally, it also extracts the directory traversal code into a function shared by all directory operation functions.
Summary of major changes
directoryDeleteRecursive()anddirectoryCopy()no longer follow links, now they only delete or create links;directoryListEntries()was added and shared by all directory functions.fileReadLink2()was added to implement a convenient and consistent way for checking if a path is a symlink and what the real path is.Hints for unit tests
directoryDeleteRecursive,directoryCopy,directoryChangeModeRecursive,directoryChangeOwnerRecursive,fileReadLink2,directoryListEntries;All files must be in mode 644, all directories must be in mode 755.
All files and directories must owned by user1 and group1.