Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Praveer1981
Copy link

@Praveer1981 Praveer1981 commented Dec 5, 2020

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

@welcome
Copy link

welcome bot commented Dec 5, 2020

Thank you for submitting a pull request! If this is your first PR, make sure to add yourself to AUTHORS.

@sbc100
Copy link
Collaborator

sbc100 commented Dec 5, 2020

Thanks! This will be very useful in tracking down the regression.

Can you add @disabled(<url_of_bug>) so that we can land the test now and fix as a followup?

// Now get the file permission which was set above
std::__fs::filesystem::perms perm = s.permissions();

printResult((int)perm);
Copy link
Collaborator

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.

std::__fs::filesystem::permissions(fileName,std::__fs::filesystem::perms::group_read,ec);
if (ec) {
//std::cout <<__FILE__<<" "<<__FUNCTION__ <<" "<<__LINE__<< " " << ec << "\n" ;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just assert(!ec)

ofs.close();

// check whether file exist or not
if (std::__fs::filesystem::exists(fileName))
Copy link
Collaborator

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)


printResult((int)perm);
return 0;
}
Copy link
Collaborator

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.

@@ -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')
Copy link
Collaborator

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?

@Praveer1981
Copy link
Author

@sbc100 Thanks for your comments, I have updated the code.

Base automatically changed from master to main March 8, 2021 23:49
@stale
Copy link

stale bot commented Apr 16, 2022

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.

@stale stale bot added the wontfix label Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants