Skip to content

Commit a8908e4

Browse files
authored
Drop centos6 and update pyperf test (#1041)
* Drop centos6 and update pyperf test Signed-off-by: Min Lim <min.yeol.lim@intel.com> * Update based on copilot review comments Signed-off-by: Min Lim <min.yeol.lim@intel.com> * Increase the call so that samples are captured Signed-off-by: Min Lim <min.yeol.lim@intel.com> --------- Signed-off-by: Min Lim <min.yeol.lim@intel.com>
1 parent ca3c904 commit a8908e4

7 files changed

Lines changed: 25 additions & 19 deletions

File tree

.github/workflows/build-base-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
--build-arg PHPSPY_BUILDER_UBUNTU=@sha256:cf31af331f38d1d7158470e095b132acd126a7180a54f263d386da88eb681d93
7474
--build-arg AP_BUILDER_CENTOS=@sha256:0f4ec88e21daf75124b8a9e5ca03c37a5e937e0e108a255d890492430789b60e
7575
--build-arg AP_BUILDER_ALPINE=@sha256:69704ef328d05a9f806b6b8502915e6a0a4faa4d72018dc42343f511490daf8a
76-
--build-arg AP_CENTOS_MIN=:6
76+
--build-arg AP_CENTOS_MIN=:7
7777
--build-arg BURN_BUILDER_GOLANG=@sha256:f7d3519759ba6988a2b73b5874b17c5958ac7d0aa48a8b1d84d66ef25fa345f1
7878
--build-arg GPROFILER_BUILDER=@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4
7979
--build-arg PYPERF_BUILDER_UBUNTU=@sha256:cf31af331f38d1d7158470e095b132acd126a7180a54f263d386da88eb681d93

.github/workflows/build-test-deploy.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ jobs:
8585
- ubuntu:20.04
8686
- ubuntu:20.10
8787
- ubuntu:22.04
88-
- centos:6
8988
- centos:7
9089
- centos:8
9190
- debian:8

scripts/build_x86_64_executable.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,13 @@ UBUNTU_VERSION_1804=@sha256:dca176c9663a7ba4c1f0e710986f5a25e672842963d95b960191
3939
# phpspy & pyperf - ubuntu:20.04
4040
UBUNTU_VERSION=@sha256:cf31af331f38d1d7158470e095b132acd126a7180a54f263d386da88eb681d93
4141
# async-profiler glibc - centos:7
42-
# requires CentOS 7 so the built DSO can be loaded into machines running with old glibc (tested up to centos:6),
43-
# we do make some modifications to the selected versioned symbols so that we don't use anything from >2.12 (what centos:6
44-
# has)
4542
AP_BUILDER_CENTOS=@sha256:0f4ec88e21daf75124b8a9e5ca03c37a5e937e0e108a255d890492430789b60e
4643
# async-profiler musl - alpine
4744
AP_BUILDER_ALPINE=@sha256:69704ef328d05a9f806b6b8502915e6a0a4faa4d72018dc42343f511490daf8a
4845
# dotnet builder - mcr.microsoft.com/dotnet/sdk:6.0.428-1-focal
4946
DOTNET_BUILDER=@sha256:525ce79a6f545131df515ce34f7ee086eb18e4d707eff9676b2678f2f23b6d9e
50-
# minimum CentOS version we intend to support with async-profiler (different between x86_64, where we require
51-
# an older version)
52-
AP_CENTOS_MIN=:6
47+
# minimum CentOS version we intend to support with async-profiler
48+
AP_CENTOS_MIN=:7
5349
# burn - golang:1.16.3
5450
BURN_BUILDER_GOLANG=@sha256:f7d3519759ba6988a2b73b5874b17c5958ac7d0aa48a8b1d84d66ef25fa345f1
5551
# bcc & gprofiler - centos:7

tests/containers/python/lister.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,6 @@ def parser():
4949
Thread(target=parser).start()
5050
lister = Lister()
5151
while True:
52-
lister.lister()
52+
# Call multiple times per iteration to increase chance of being sampled by profilers
53+
for _ in range(10):
54+
lister.lister()

tests/test_executable.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ def test_executable(
5555
pytest.xfail("Dotnet-trace doesn't work with alpine: https://github.com/intel/gprofiler/issues/795")
5656

5757
if exec_container_image is not None:
58-
if "centos:6" in exec_container_image.tags and any("pyperf" in flag for flag in profiler_flags):
59-
# don't run PyPerf on the centos:6 image, it fails. And in any case PyPerf can't run on centos:6.
60-
pytest.skip("PyPerf test on centos:6")
61-
6258
gprofiler_inner_dir = Path("/app")
6359
inner_output_dir = Path("/app/output")
6460
cwd = Path(os.getenv("GITHUB_WORKSPACE", os.getcwd()))

tests/test_python.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def test_python_select_by_libpython(
8787
"3.7-musl-uwsgi",
8888
],
8989
)
90+
@pytest.mark.flaky(reruns=3, reruns_delay=2)
9091
@pytest.mark.parametrize("profiler_type", ["py-spy", "pyperf"])
9192
def test_python_matrix(
9293
application_pid: int,
@@ -119,9 +120,15 @@ def test_python_matrix(
119120
):
120121
pytest.xfail("This combination fails, see https://github.com/Granulate/gprofiler/issues/714")
121122

122-
with PythonProfiler(1000, 2, profiler_state, profiler_type, True, None, False, python_pyspy_process=[]) as profiler:
123+
# Use longer duration for pyperf to ensure enough samples are collected for reliable assertions
124+
duration = 5 if profiler_type == "pyperf" else 2
125+
# Timeout should be longer than duration to allow profiling to complete
126+
snapshot_timeout = duration + 5
127+
with PythonProfiler(
128+
1000, duration, profiler_state, profiler_type, True, None, False, python_pyspy_process=[]
129+
) as profiler:
123130
try:
124-
profile = snapshot_pid_profile(profiler, application_pid)
131+
profile = snapshot_pid_profile(profiler, application_pid, timeout=snapshot_timeout)
125132
except TimeoutError:
126133
if profiler._ebpf_profiler is not None and profiler._ebpf_profiler.process is not None:
127134
PythonEbpfProfiler._check_output(profiler._ebpf_profiler.process, profiler._ebpf_profiler.output_path)
@@ -183,8 +190,14 @@ def test_dso_name_in_pyperf_profile(
183190
if is_aarch64() and profiler_type == "pyperf":
184191
pytest.skip("PyPerf doesn't support aarch64 architecture, see https://github.com/intel/gprofiler/issues/499")
185192

186-
with PythonProfiler(1000, 2, profiler_state, profiler_type, True, None, True, python_pyspy_process=[]) as profiler:
187-
profile = snapshot_pid_profile(profiler, application_pid)
193+
# Use longer duration for pyperf to ensure enough samples are collected
194+
duration = 5 if profiler_type == "pyperf" else 2
195+
# Timeout should be longer than duration to allow profiling to complete
196+
snapshot_timeout = duration + 5
197+
with PythonProfiler(
198+
1000, duration, profiler_state, profiler_type, True, None, True, python_pyspy_process=[]
199+
) as profiler:
200+
profile = snapshot_pid_profile(profiler, application_pid, timeout=snapshot_timeout)
188201
python_version, _, _ = application_image_tag.split("-")
189202
interpreter_frame = "PyEval_EvalFrameEx" if python_version == "2.7" else "_PyEval_EvalFrameDefault"
190203
collapsed = profile.stacks

tests/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def assert_ldd_version_container(container: Container, version: str) -> None:
206206
assert version_in_container == version, f"ldd version in container: {version_in_container}, expected {version}"
207207

208208

209-
def snapshot_pid_profile(profiler: ProfilerInterface, pid: int) -> ProfileData:
209+
def snapshot_pid_profile(profiler: ProfilerInterface, pid: int, timeout: int = 5) -> ProfileData:
210210
last_snapshot = profiler.snapshot()
211211

212212
def has_profile() -> bool:
@@ -216,7 +216,7 @@ def has_profile() -> bool:
216216
last_snapshot = profiler.snapshot()
217217
return pid in last_snapshot
218218

219-
wait_event(timeout=5, stop_event=Event(), condition=has_profile, interval=2.0)
219+
wait_event(timeout=timeout, stop_event=Event(), condition=has_profile, interval=2.0)
220220
return last_snapshot[pid]
221221

222222

0 commit comments

Comments
 (0)