-
Notifications
You must be signed in to change notification settings - Fork 820
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Enable profiling in integration tests (#5130)
- Loading branch information
Showing
4 changed files
with
101 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from pathlib import Path | ||
|
||
services = [ | ||
"cloud-init-local.service", | ||
"cloud-init.service", | ||
"cloud-config.service", | ||
"cloud-final.service", | ||
] | ||
service_dir = Path("/lib/systemd/system/") | ||
|
||
# Check for the existence of the service files | ||
for service in services: | ||
if not (service_dir / service).is_file(): | ||
print(f"Error: {service} does not exist in {service_dir}") | ||
exit(1) | ||
|
||
# Prepend the ExecStart= line with 'python3 -m coverage run' | ||
for service in services: | ||
file_path = service_dir / service | ||
content = file_path.read_text() | ||
content = content.replace( | ||
"ExecStart=/usr", | ||
(f"ExecStart=python3 -m cProfile -o /var/log/{service}.stats /usr"), | ||
) | ||
file_path.write_text(content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters