This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tymux-10-quiet-head
in repository terminology.
View the commit online.
commit 85148214347abaeef14c5fd1961f296bf24289fd
Author: Boris Faure <[email protected]>
AuthorDate: Sun Nov 15 18:55:35 2026 +0000
tests: add the osc-7501 shell scripts
tytest folds the records into its state checksum, least recently
updated first, and dumps them, so the scripts can check the store end
to end. Nothing is hashed when there are no records, so no existing
checksum moves.
osc-7501.sh feeds plain reports, osc-7501-invalid.sh the values that
are absent or discard the whole report, and osc-7501-records.sh the
store itself: the 256 cap with eviction, clear on a record and its
children, RIS, and the alternate screen with DECSTR.
---
src/bin/termptystatus.h | 3 +++
src/bin/tytest.c | 33 +++++++++++++++++++++++++++++++++
tests/osc-7501-invalid.sh | 36 ++++++++++++++++++++++++++++++++++++
tests/osc-7501-records.sh | 36 ++++++++++++++++++++++++++++++++++++
tests/osc-7501.sh | 20 ++++++++++++++++++++
tests/tests.results | 3 +++
6 files changed, 131 insertions(+)
diff --git a/src/bin/termptystatus.h b/src/bin/termptystatus.h
index 2ef762dc..49e834d6 100644
--- a/src/bin/termptystatus.h
+++ b/src/bin/termptystatus.h
@@ -40,6 +40,9 @@ typedef struct _Termpty_Program_Record
char *msg; /* NULL when the report had none */
} Termpty_Program_Record;
+/* A text line holding one whole record, as tytest dumps and hashes */
+#define TERMPTY_PROGRAM_STATUS_LINE_MAX 2432
+
/* Parse and apply the payload of an OSC 7501. body is the text after
* "7501;"; an empty or malformed payload changes nothing and is not a
* decoding error. */
diff --git a/src/bin/tytest.c b/src/bin/tytest.c
index b0113594..7c58bda1 100644
--- a/src/bin/tytest.c
+++ b/src/bin/tytest.c
@@ -13,6 +13,7 @@
#include "config.h"
#include "termpty.h"
#include "termptyops.h"
+#include "termptystatus.h"
#include "backlog.h"
#include "utf8.h"
#include "simd/simd.h"
@@ -695,6 +696,24 @@ _tytest_checksum_hex(Termpty *ty, char *md5out)
MD5Update(&ctx, &ty->progress.value, 1);
}
+ /* Program status records (OSC 7501), least recently updated first,
+ * so tests that send none are unchanged. */
+ if (ty->program_records)
+ {
+ const Termpty_Program_Record *rec;
+ char line[TERMPTY_PROGRAM_STATUS_LINE_MAX];
+
+ EINA_INLIST_FOREACH(ty->program_records, rec)
+ {
+ snprintf(line, sizeof(line), "%s|%d|%d|%d|%s|%s|%s\n",
+ rec->id, (int)rec->state, (int)rec->kind,
+ (int)rec->progress, rec->app,
+ rec->title ? rec->title : "-",
+ rec->msg ? rec->msg : "-");
+ MD5Update(&ctx, (unsigned char const*)line, strlen(line));
+ }
+ }
+
/* Cursor shape */
const char *cursor_shape = tytest_cursor_shape_get();
MD5Update(&ctx, (unsigned char const*)cursor_shape,
@@ -975,6 +994,20 @@ _tytest_dump(Termpty *ty)
printf("cwd=%s\n", ty->prop.cwd ? ty->prop.cwd : "(NULL)");
printf("progress state=%d value=%d\n",
(int)ty->progress.state, (int)ty->progress.value);
+ if (ty->program_records)
+ {
+ const Termpty_Program_Record *rec;
+
+ EINA_INLIST_FOREACH(ty->program_records, rec)
+ {
+ printf("program_status id=%s state=%d kind=%d progress=%d "
+ "app=%s title=%s msg=%s\n",
+ rec->id, (int)rec->state, (int)rec->kind,
+ (int)rec->progress, rec->app,
+ rec->title ? rec->title : "(none)",
+ rec->msg ? rec->msg : "(none)");
+ }
+ }
printf("notifications=%s\n",
tytest_notifications_get() ? tytest_notifications_get() : "(none)");
diff --git a/tests/osc-7501-invalid.sh b/tests/osc-7501-invalid.sh
new file mode 100644
index 00000000..3b6d76c2
--- /dev/null
+++ b/tests/osc-7501-invalid.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# shellcheck source=tests/utils.sh
+. "$(dirname "$0")/utils.sh"
+
+# one known record; every report below must leave the records unchanged
+printf '\033]7501;id=keep:state=idle\033\\'
+printf '\033]7501;id=x\033\\' # no state
+printf '\033]7501;id=x:state=sleeping\033\\' # unknown state
+printf '\033]7501;id=a//b:state=idle\033\\' # bad id
+printf '\033]7501;id=a/b/c/d/e/f/g/h/i:state=idle\033\\' # 9 levels
+printf '\033]7501;state=idle:msg=YQpi\033\\' # newline in msg
+printf '\033]7501;state=idle:msg=YQli\033\\' # tab in msg
+printf '\033]7501;state=idle:msg=Q\033\\' # bad base64
+printf '\033]7501\007' # no body
+printf '\033]7501;\033\\' # empty body
+
+# a title over the 256 encoded byte maximum; 260 keeps the base64 shape
+# valid, so only the size check can reject it
+printf '\033]7501;id=t:state=done:title='
+printf '%*s' 260 '' | tr ' ' A
+printf '\033\\'
+
+# a msg over the 2732 encoded byte maximum, shape still valid
+printf '\033]7501;id=m:state=working:msg='
+printf '%*s' 2736 '' | tr ' ' A
+printf '\033\\'
+
+# an id segment of 33 bytes, one over the limit
+printf '\033]7501;id='
+printf '%*s' 33 '' | tr ' ' A
+printf ':state=idle\033\\'
+
+# an OSC longer than the 4096 codepoint buffer is discarded up to its ST
+printf '\033]7501;id=big:state=working:msg='
+printf '%*s' 4100 '' | tr ' ' A
+printf '\033\\X'
diff --git a/tests/osc-7501-records.sh b/tests/osc-7501-records.sh
new file mode 100644
index 00000000..0a438d9c
--- /dev/null
+++ b/tests/osc-7501-records.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# shellcheck source=tests/utils.sh
+. "$(dirname "$0")/utils.sh"
+
+# 257 records: the cap is 256, so the least recently updated one goes.
+# Refreshing r0 before the 257th makes r1 the one evicted.
+i=0
+while [ $i -lt 256 ]; do
+ printf '\033]7501;id=r%d:state=idle\033\\' "$i"
+ i=$((i+1))
+done
+printf '\033]7501;id=r0:state=working\033\\'
+printf '\033]7501;id=r256:state=idle\033\\'
+
+# a parent with children, and a sibling sharing the parent's prefix
+printf '\033]7501;id=a:state=working\033\\'
+printf '\033]7501;id=a/b:state=working\033\\'
+printf '\033]7501;id=a/b/c:state=done\033\\'
+printf '\033]7501;id=ab:state=error\033\\'
+# clear on the parent takes the children, the sibling stays
+printf '\033]7501;id=a:state=clear\033\\'
+# clear with no id takes everything
+printf '\033]7501;state=clear\033\\'
+
+# RIS removes every record
+printf '\033]7501;id=m1:state=working\033\\'
+printf '\033]7501;id=m2:state=done\033\\'
+printf '\033c'
+
+# records survive the alternate screen and DECSTR
+printf '\033[?1049h'
+printf '\033]7501;id=alt:state=working\033\\'
+printf '\033[!p'
+printf '\033[?1049l'
+printf '\033]7501;id=s1:state=done\033\\'
+printf '\033]7501;id=s2:state=error\007'
diff --git a/tests/osc-7501.sh b/tests/osc-7501.sh
new file mode 100644
index 00000000..2352c22c
--- /dev/null
+++ b/tests/osc-7501.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+# shellcheck source=tests/utils.sh
+. "$(dirname "$0")/utils.sh"
+
+# root record, replaced completely: msg must be gone after the second one
+printf '\033]7501;state=working:progress=40:msg=Y2FyZ28gdGVzdA==\033\\'
+printf '\033]7501;state=working\007'
+# blocked with kind, app and unpadded base64
+printf '\033]7501;id=tf:state=blocked:kind=permission:app=terraform:msg=QXBwbHkgMyBjaGFuZ2VzPw\033\\'
+# out-of-range or misplaced values become absent
+printf '\033]7501;id=a:state=working:progress=101:kind=auth\033\\'
+printf '\033]7501;id=b:state=done:progress=50:app=bad!app\033\\'
+# whitespace, repeated and unknown keys
+printf '\033]7501; id = c : state=idle : state=error : colour=red \033\\'
+# a malformed pair is skipped, the rest applies
+printf '\033]7501;id=d:nonsense:STATE=x:state=done\033\\'
+# title
+printf '\033]7501;id=e:state=done:title=QnVpbGQgT0s=\033\\'
+# U+202E is stripped from the text, the report still applies
+printf '\033]7501;id=f:state=done:msg=4oCuZXZpbA==\033\\'
diff --git a/tests/tests.results b/tests/tests.results
index 986f4c41..c94fd64b 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -154,6 +154,9 @@ osc-99-chunks.sh 7b65134890f0cff0c1f06664a45135b2
osc-99-notify.sh fd9e2e812e2a035c87971e141a0dd4db
osc-99-query.sh 0fd52c3dd0381988baa88554858cc7c5
osc-99-occasion.sh f66bc070f39a87a6884b14ad15df76d9
+osc-7501.sh 34fdeb17e8ea39728064333158a99b1c
+osc-7501-invalid.sh 535a4caa2aa67567dea2ef8e6dd1b4b8
+osc-7501-records.sh ac70572df8728584fd1549d5b77ddbb2
osc-colors-ris.sh ae9b8008e2cb1fa2bae13a471c90733f
osc-110-112.sh 318a0f4da4b07567353e057bb2de5b2b
osc-colors-st.sh 84636d0d4589573e1e9b3c0fcceb2091
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.