From 59c48c8247e2c426e5d6200860e09c3a8576df59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zachar?= Date: Thu, 15 May 2025 18:09:20 +0200 Subject: [PATCH] DO NOT MERGE the spec change Adding test for inplace upgrade of running python https://bugzilla.redhat.com/show_bug.cgi?id=233385 --- .fmf/version | 1 + plans/runtime.fmf | 12 ++++++++++++ python3.13.spec | 2 +- tests/runtime/main.fmf | 2 ++ tests/runtime/repro.py | 19 +++++++++++++++++++ tests/runtime/test.sh | 31 +++++++++++++++++++++++++++++++ 6 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .fmf/version create mode 100644 plans/runtime.fmf create mode 100644 tests/runtime/main.fmf create mode 100644 tests/runtime/repro.py create mode 100755 tests/runtime/test.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plans/runtime.fmf b/plans/runtime.fmf new file mode 100644 index 0000000..155fd7c --- /dev/null +++ b/plans/runtime.fmf @@ -0,0 +1,12 @@ +execute: + how: tmt + +discover: + how: fmf + test: /runtime + path: ./tests + +prepare: + - name: install + how: install + exclude: '*' diff --git a/python3.13.spec b/python3.13.spec index dac363e..486c52b 100644 --- a/python3.13.spec +++ b/python3.13.spec @@ -17,7 +17,7 @@ URL: https://www.python.org/ #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} -Release: 3%{?dist} +Release: 3%{?dist}_test License: Python-2.0.1 diff --git a/tests/runtime/main.fmf b/tests/runtime/main.fmf new file mode 100644 index 0000000..3fede6b --- /dev/null +++ b/tests/runtime/main.fmf @@ -0,0 +1,2 @@ +test: ./test.sh +framework: beakerlib diff --git a/tests/runtime/repro.py b/tests/runtime/repro.py new file mode 100644 index 0000000..18238dc --- /dev/null +++ b/tests/runtime/repro.py @@ -0,0 +1,19 @@ +import time +from pathlib import Path + + +flag_file = Path('/tmp/runtime') +status_file = Path('/tmp/runtime_status') +assert not flag_file.exists() + +print(f'Started - touch {flag_file} when ready') +print(f'Status in {status_file}') +status_file.write_text('running') + +while not flag_file.exists(): + time.sleep(2) + +import email.parser +print('DONE') +status_file.write_text('PASS') + diff --git a/tests/runtime/test.sh b/tests/runtime/test.sh new file mode 100755 index 0000000..1a687fd --- /dev/null +++ b/tests/runtime/test.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +STATUS_FILE=/tmp/runtime_status +FLAG_FILE=/tmp/runtime + +cleanup(){ + for f in $STATUS_FILE $FLAG_FILE; do + test -e $f && rm -f $f + done +} + +rlJournalStart + rlPhaseStartTest + cleanup + + rlRun "rpm -q python3 && python3 --version" + python3 repro.py & + rlWaitForFile $STATUS_FILE + rlRun "dnf update -y python*" + rlRun "rpm -q python3 && python3 --version" + rlRun "touch $FLAG_FILE" + sleep 2 + rlAssertGrep 'PASS' $STATUS_FILE + rlPhaseEnd + + rlPhaseStartCleanup + cleanup + rlPhaseEnd +rlJournalEnd