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

Fix/apptester #6663

Merged
merged 4 commits into from
Dec 17, 2021
Merged

Fix/apptester #6663

merged 4 commits into from
Dec 17, 2021

Conversation

kozlovsky
Copy link
Contributor

@kozlovsky kozlovsky commented Dec 16, 2021

Currently, the CodeExecutor of Tribler used by ApplicationTester does not catch errors properly. To catch errors during the execution of the action, it temporarily replaces stdout and stderr with StringIO objects and then attempts to detect an error by analyzing the output of stderr.

With the current Tribler code, this approach does not work correctly. To write errors to stderr, Python logger creates StreamHandler object that caches reference to stderr. When CodeExecutor replaces stderr to StringIO object, StreamHandler continues to write errors to the original stderr stream, and the errors go unnoticed by CodeExecutor.

This PR fixes error detection in CodeExecutor. Instead of replacing the stderr stream with the StringIO object, it defines the showtraceback hook that catches exceptions arising during the ApplicationTester action.

Also, this PR fixes reporting GUI errors to stderr (sometimes, the error was suppressed by logic in the gui_error handler).

The last change is an automatic screenshot taking when an exception occurs in the CodeExecutor action evaluation. If the application tester passes the app_tester_dir value to the script, it is used as a root directory for screenshot saving.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@kozlovsky kozlovsky marked this pull request as ready for review December 17, 2021 10:09
@kozlovsky kozlovsky requested review from a team and xoriole and removed request for a team December 17, 2021 10:09
@kozlovsky kozlovsky merged commit 6bca340 into Tribler:release/7.11 Dec 17, 2021
@kozlovsky kozlovsky deleted the fix/apptester branch December 17, 2021 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants