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

utils/cpu: Check cpu list for s390x [v3] #2353

Closed

Conversation

clebergnu
Copy link
Contributor

The output in /proc/cpuinfo is different between s390x and other archs.
This is to support to parse the output on s390x.

Signed-off-by: Dan Zheng [email protected]
Signed-off-by: Cleber Rosa [email protected]


Changes from v2 (#2351):

  • Added x86_64 test

Changes from v1 (#2300):

  • Added unittests considering a real and slightly faked output from /proc/cpuinfo on s390x

dzhengfy and others added 2 commits December 13, 2017 09:47
The output in /proc/cpuinfo is different between s390x and other archs.
This is to support to parse the output on s390x.

Signed-off-by: Dan Zheng <[email protected]>
Signed-off-by: Cleber Rosa <[email protected]>
This simple test, after the s390x version, checks the proper parsing
of and x86_64 /proc/cpuinfo.

Signed-off-by: Cleber Rosa <[email protected]>
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
Copy link
Contributor

Choose a reason for hiding this comment

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

That's long 😄 anyway good to go.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, unfortunately inspekt does not treat the empty lines properly. Would you please use an external file instead of in-code representation? (or whatever makes inspekt happy)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's actually indent messing with the actual content of the strings. inspekt indent --fix selftest/unit/test_utils_cpu.py shows how it adds a space between the key and value.

I'm skipping the indent check for this one file, and filing an issue in inspektor:

avocado-framework/inspektor#31

with mock.patch('avocado.utils.cpu.platform.machine', return_value='x86_64'):
with mock.patch('avocado.utils.cpu.open',
return_value=self._get_file_mock(x86_64)):
self.assertEqual(len(cpu.cpu_online_list()), 8)
Copy link
Contributor

Choose a reason for hiding this comment

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

Btw I just noticed the simplified check, maybe later we could introduce better check to actually see which cpus are enabled as this function is suppose to detect the online cpu numbers is not just the total count... (eg. on Power with disabled threading is usually 0 8 16 32 ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can always expand the test coverage, surely a good thing.

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