Skip to content

Conversation

@asomsiko
Copy link

No description provided.

Also change root for test_log_file_names tests to be
a temporary directory to allow runnig tests without sudo.
The old root `/` or `C:` is not usually writable for regular users.
Copy link
Contributor

@pbos pbos left a comment

Choose a reason for hiding this comment

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

Sorry for the slow response time, new parent here.

os.remove(log_name)
except OSError as os_error:
# truncate file name if error is Errno 36: File name too long
if os_error.errno == 36:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be errno.ENAMETOOLONG instead of the comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

Task._normalize(test_name), execution_number)
# The log file name is a combination of a test binary name and a test name.
# If the log file name exceeds OS limitations it will be truncated.
MKSTEMP_RANDOM_LEN = 12 # length of mkstemp random string being added
Copy link
Contributor

Choose a reason for hiding this comment

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

"# Space reserved for mkstemp suffix."

# truncate file name if error is Errno 36: File name too long
if os_error.errno == 36:
prefix_length = ((os.statvfs('.').f_namemax -
MKSTEMP_RANDOM_LEN) if hasattr(os, 'statvfs') else MAX_PREFIX_LENGTH) - len(suffix)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would read easier as: if hasattr(..): prefix_length = ..., i.e. avoid the ternary. as it's long.

'Test.case', 1))
MAX_PREFIX_LENGTH = 240
long_test_name = 'a' * (os.statvfs('.').f_namemax if hasattr(os,
'statvfs') else MAX_PREFIX_LENGTH + 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you make this one a separate test? Maybe test_truncates_file_name

Also I think this test only makes sense on systems that have statvfs, can it run conditionally? This test requires OSes without statvfs to reject filenames that are longer which is maybe not what we want. I'm OK with not testing the MAX_PREFIX_LENGTH branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants