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

[checkbox-ce-oem] Add check when not able to read node (Bugfix) #1347

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

LiaoU3
Copy link
Contributor

@LiaoU3 LiaoU3 commented Jul 19, 2024

Description

It did not handle error correctly when unable to read node. Hence I propose this PR to check check it and make the error message easy to understand.

Unable to read the node

ubuntu@ubuntu:/sys/class/thermal$ sudo cat thermal_zone1/temp
cat: thermal_zone1/temp: Resource temporarily unavailable

ubuntu@ubuntu:/sys/class/thermal$ sudo cat thermal_zone2/temp
cat: thermal_zone2/temp: Resource temporarily unavailable

ubuntu@ubuntu:/sys/class/thermal$ sudo cat thermal_zone3/temp
cat: thermal_zone3/temp: Resource temporarily unavailable

ubuntu@ubuntu:/sys/class/thermal$ sudo cat thermal_zone4/temp
cat: thermal_zone4/temp: Resource temporarily unavailable

Before

Traceback (most recent call last):
  File "/tmp/nest-487v6cqq.1b39665063c258e5aa39344ed03d474aa2913338bf3cafddd02d2ad241fabbf3/thermal_sensor_test.py", line 201, in <module>
    main()
  File "/tmp/nest-487v6cqq.1b39665063c258e5aa39344ed03d474aa2913338bf3cafddd02d2ad241fabbf3/thermal_sensor_test.py", line 197, in main
    args.test_type(args)
  File "/tmp/nest-487v6cqq.1b39665063c258e5aa39344ed03d474aa2913338bf3cafddd02d2ad241fabbf3/thermal_sensor_test.py", line 105, in thermal_monitor_test
    initial_value = thermal_op.temperature
  File "/tmp/nest-487v6cqq.1b39665063c258e5aa39344ed03d474aa2913338bf3cafddd02d2ad241fabbf3/thermal_sensor_test.py", line 69, in temperature
    temp = self._read_node(self.temp_node)
  File "/tmp/nest-487v6cqq.1b39665063c258e5aa39344ed03d474aa2913338bf3cafddd02d2ad241fabbf3/thermal_sensor_test.py", line 55, in _read_node
    return node.read_text().strip("\n")
  File "/snap/checkbox22/current/usr/lib/python3.10/pathlib.py", line 1135, in read_text
    return f.read()
  File "/snap/checkbox22/current/usr/lib/python3.10/codecs.py", line 321, in decode
    data = self.buffer + input
TypeError: can't concat NoneType to bytes

After

2024-07-19 07:24:09 INFO     # Monitor the temperature of thermal_zone1 thermal around 60 seconds
Failed to read node: /sys/class/thermal/thermal_zone1/temp
can't concat NoneType to bytes

Resolved issues

LP#2071402

Documentation

N/A

Tests

https://certification.canonical.com/hardware/202406-34151/submission/381693/

@fernando79513 fernando79513 added the ce-oem The PR only contains to the ce-oem provider under the contrib area label Aug 1, 2024
Copy link
Collaborator

@zongminl zongminl left a comment

Choose a reason for hiding this comment

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

LGTM, thank you.

@zongminl zongminl merged commit af8a079 into main Aug 6, 2024
5 checks passed
@zongminl zongminl deleted the themal_check branch August 6, 2024 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ce-oem The PR only contains to the ce-oem provider under the contrib area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants