-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a test case to test std::filesystem's Permissions() function #12974
base: main
Are you sure you want to change the base?
Added a test case to test std::filesystem's Permissions() function #12974
Conversation
Thank you for submitting a pull request! If this is your first PR, make sure to add yourself to AUTHORS. |
Thanks! This will be very useful in tracking down the regression. Can you add |
tests/core/test_std_fileSystem.cpp
Outdated
// Now get the file permission which was set above | ||
std::__fs::filesystem::perms perm = s.permissions(); | ||
|
||
printResult((int)perm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do something like: std::cout<< "file permissions: " << value << std::endl;
.. I think its better to have some kind of indication in the output file as to what the integer being printed represents.
tests/core/test_std_fileSystem.cpp
Outdated
std::__fs::filesystem::permissions(fileName,std::__fs::filesystem::perms::group_read,ec); | ||
if (ec) { | ||
//std::cout <<__FILE__<<" "<<__FUNCTION__ <<" "<<__LINE__<< " " << ec << "\n" ; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just assert(!ec)
tests/core/test_std_fileSystem.cpp
Outdated
ofs.close(); | ||
|
||
// check whether file exist or not | ||
if (std::__fs::filesystem::exists(fileName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe assert(std::__fs::filesystem::exists(fileName)
tests/core/test_std_fileSystem.cpp
Outdated
|
||
printResult((int)perm); | ||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this file and the expected output file need an newline at the end.
tests/test_core.py
Outdated
@@ -5058,6 +5058,9 @@ def test_direct_string_constant_usage(self): | |||
def test_std_cout_new(self): | |||
self.do_run_in_out_file_test('tests', 'core', 'test_std_cout_new.cpp') | |||
|
|||
def test_std_fileSystem(self): | |||
self.do_run_in_out_file_test('tests', 'core', 'test_std_fileSystem.cpp') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about calling this test_std_filesystem_permissions
?
@sbc100 Thanks for your comments, I have updated the code. |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
reference :
Issue#12932
This is the test case to test the permissions function of the std::filesystem , it was regressed in emscripten 1.39.9