public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Takao Fujiwara <tfujiwar@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/ibus] autotool: Generate results.yml to follow the defined result format
Date: Sun, 31 May 2026 02:07:42 GMT	[thread overview]
Message-ID: <178019326203.1.8365601007335780394.rpms-ibus-dbcbd82fc131@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/ibus
            Branch : autotool
            Commit : dbcbd82fc13192d3b46a75f96c871f1213b3309c
            Author : Takao Fujiwara <tfujiwar@redhat.com>
            Date   : 2021-08-28T09:43:35+09:00
            Stats  : +67/-14 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/ibus/c/dbcbd82fc13192d3b46a75f96c871f1213b3309c?branch=autotool

            Log:
            Generate results.yml to follow the defined result format

https://docs.fedoraproject.org/en-US/ci/standard-test-interface/#_results_format

---
diff --git a/tests/roles/ibus-desktop-testing-role/files/check-results.sh b/tests/roles/ibus-desktop-testing-role/files/check-results.sh
new file mode 100755
index 0000000..1160dac
--- /dev/null
+++ b/tests/roles/ibus-desktop-testing-role/files/check-results.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+TEST_LOG="test.log"
+TEST_RUN_IN_RAWHIDE="1"
+
+if [ $# -gt 0 ] ; then
+    TEST_LOG="$1"
+    TEST_RUN_IN_RAWHIDE="$2"
+fi
+
+gen_results()
+{
+    TEST_RUNTIME="$1"
+    TEST_STATUS="$2"
+    TEST_STATUS_UPPER="$(echo "$TEST_STATUS" | tr '[:lower:]' '[:upper:]')"
+    cat > results.xml << _EOF
+results:
+
+- test: results
+  result: $TEST_STATUS
+  runtime: $TEST_RUNTIME
+  logs:
+  - ${TEST_STATUS_UPPER}-str_results.log
+
+_EOF
+
+    DIR=$(dirname "$TEST_LOG")
+    if [ x"$TEST_LOG" != x ] ; then
+       cp "$TEST_LOG" "$DIR/${TEST_STATUS_UPPER}-str_results.log"
+    else
+       touch "$DIR/${TEST_STATUS_UPPER}-str_results.log"
+    fi
+    if [ x"$DIR" != x. ] ; then
+        mv results.xml "$DIR"
+    fi
+}
+
+if [ $TEST_RUN_IN_RAWHIDE -eq 0 ] ; then
+    IS_RAWHIDE="$(grep -i rawhide /etc/fedora-release)"
+    if [ x"$IS_RAWHIDE" != x ] ; then
+        gen_results "0" "pass"
+        exit 0
+    fi
+fi
+if [ ! -f $TEST_LOG ] ; then
+    gen_results "0" "fail"
+    echo ERROR
+else
+    FAIL="$(grep "^FAIL: " $TEST_LOG | grep -v 'FAIL: 0$')"
+    RUNTIME_FAIL="$(grep -v 'frame' $TEST_LOG | grep "^FAIL: " | sed -e "s/FAIL: //")"
+    RUNTIME_PASS="$(grep -v 'frame' $TEST_LOG | grep "^PASS: " | sed -e "s/PASS: //")"
+    if [ x"$RUNTIME_FAIL" = x ] ; then
+        RUNTIME_FAIL="0"
+    fi
+    if [ x"$RUNTIME_PASS" = x ] ; then
+        RUNTIME_PASS="0"
+    fi
+    RUNTIME="$(expr $RUNTIME_FAIL + $RUNTIME_PASS)"
+    if [ x"$FAIL" != x ] ; then
+        gen_results "$RUNTIME" "fail"
+        echo ERROR
+    else
+        gen_results "$RUNTIME" "pass"
+    fi
+fi
+

diff --git a/tests/roles/ibus-desktop-testing-role/tasks/main.yml b/tests/roles/ibus-desktop-testing-role/tasks/main.yml
index c377a52..cbe0f80 100644
--- a/tests/roles/ibus-desktop-testing-role/tasks/main.yml
+++ b/tests/roles/ibus-desktop-testing-role/tasks/main.yml
@@ -114,20 +114,7 @@
       echo "#"
 
   - name: Check the results
-    shell: |
-        IS_RAWHIDE=`grep -i rawhide /etc/fedora-release`
-        if [ x"$IS_RAWHIDE" != x ] ; then
-            exit 0
-        fi
-        log="{{ remote_artifacts }}/test.log"
-        if [ ! -f $log ] ; then
-            echo ERROR
-        else
-            FAIL=`grep "^FAIL: " $log | grep -v 'FAIL: 0$'`
-            if [ x"$FAIL" != x ] ; then
-                echo ERROR
-            fi
-        fi
+    script: check-results.sh "{{ remote_artifacts }}/test.log" "0"
     register: test_fails
     failed_when: False
 

                 reply	other threads:[~2026-05-31  2:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178019326203.1.8365601007335780394.rpms-ibus-dbcbd82fc131@fedoraproject.org \
    --to=tfujiwar@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox