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

do not report memcomp if no baseline exists #4691

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CIME/baselines/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ def read_baseline_file(baseline_file):
str
Value stored in baseline file without comments.
"""
if not os.path.exists(baseline_file):
return "\nNO file {} found".format(baseline_file)
with open(baseline_file) as fd:
lines = [x.strip() for x in fd.readlines() if not x.startswith("#") and x != ""]

Expand Down
3 changes: 3 additions & 0 deletions CIME/tests/test_unit_baselines_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import gzip
import tempfile
import unittest
import os
from unittest import mock
from pathlib import Path

Expand Down Expand Up @@ -139,6 +140,8 @@ def test_read_baseline_file_multi_line(self):
assert baseline == "sha:1df0 date:2023 1000.0\nsha:3b05 date:2023 2000.0"

def test_read_baseline_file_content(self):
if not os.path.exists("/tmp/cpl-mem.log"):
os.mknod("/tmp/cpl-mem.log")
with mock.patch(
"builtins.open", mock.mock_open(read_data="sha:1df0 date:2023 1000.0")
) as mock_file:
Expand Down
Loading