Phobos Unittesting
starcanopy
starcanopy at protonmail.com
Mon Oct 12 18:07:52 UTC 2020
I'm working on adding support for Windows' symlinks in std.file.
std.file.symlink's augmentation is straightforward, but testing
it is not as easy. The reason is because, normally, one must
confer escalated privileges to the executable making the link via
CreateSymbolicLink[A|W]. This may be obviated, in Windows 10 at
least, by enabling "Developer mode" and passing a flag to the
aforementioned function.
Thus, consider what I have right now:
auto flags = /* Default flags */;
version (StdUnittest)
{
flags |= SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;
}
By doing this, running tests shouldn't require administrator's
rights, assuming "Developer mode" is enabled. However, are the
Windows CI machines set up for this? Should there be a special
case at all?
The final concern relates to Phobos defining system_directory and
system_file for Posix and Android. These two constants are used
in testing some of std.file's functionality. For Windows, a
testing directory could be %temp% and the testing file could be
created in that directory. If my changes were approved, the file
would only have to be created twice throughout std.file's tests.
However, I'd like to know some alternatives and potential issues
to/with this!
More information about the Digitalmars-d-learn
mailing list