Просмотр исходного кода

Fixed copying old CEF files on GitHub runner

Regression renders: step video textures with LWE_FIXED_TIMESTEP so video wallpapers render the same every run
UwU 1 месяц назад
Родитель
Сommit
188dbd4292

+ 142 - 9
src/WallpaperEngine/VideoPlayback/MPV/GLPlayer.cpp

@@ -5,10 +5,12 @@
 #include <algorithm>
 #include <algorithm>
 #include <cctype>
 #include <cctype>
 #include <chrono>
 #include <chrono>
+#include <cmath>
 #include <cstdlib>
 #include <cstdlib>
 #include <mpv/render_gl.h>
 #include <mpv/render_gl.h>
 #include <mpv/stream_cb.h>
 #include <mpv/stream_cb.h>
 #include <string_view>
 #include <string_view>
+#include <thread>
 #include <utility>
 #include <utility>
 #include <vector>
 #include <vector>
 
 
@@ -25,6 +27,17 @@ bool GLPlayer::s_globalPause = false;
 // counter at the last transfer
 // counter at the last transfer
 static constexpr uint64_t UNUSED_FRAMES_BEFORE_PAUSE = 30;
 static constexpr uint64_t UNUSED_FRAMES_BEFORE_PAUSE = 30;
 
 
+// LWE_FIXED_TIMESTEP (regression renders): the video is paused and every scene frame seeks it to that frame's time, so
+// a screenshot shows the same video frame on every run
+static double fixedStep () {
+    static const double step = [] {
+	const char* value = std::getenv ("LWE_FIXED_TIMESTEP");
+	return value != nullptr ? std::max (0.0, std::strtod (value, nullptr)) : 0.0;
+    }();
+
+    return step;
+}
+
 // mpv leaves a PBO and row settings bound, later glTexImage2D calls expect GL's defaults
 // mpv leaves a PBO and row settings bound, later glTexImage2D calls expect GL's defaults
 static void resetUnpackState () {
 static void resetUnpackState () {
     glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
     glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
@@ -201,7 +214,8 @@ void GLPlayer::markUsed () const {
 }
 }
 
 
 void GLPlayer::applyPause () const {
 void GLPlayer::applyPause () const {
-    const bool paused = this->m_paused || s_globalPause || this->m_lastUsedFrame + UNUSED_FRAMES_BEFORE_PAUSE < s_frame;
+    const bool paused = this->m_paused || s_globalPause || fixedStep () > 0.0
+	|| this->m_lastUsedFrame + UNUSED_FRAMES_BEFORE_PAUSE < s_frame;
 
 
     if (this->m_handle == nullptr || paused == this->m_enginePaused) {
     if (this->m_handle == nullptr || paused == this->m_enginePaused) {
 	return;
 	return;
@@ -371,14 +385,13 @@ void GLPlayer::applyDisplaySize () const {
     }
     }
 }
 }
 
 
-void GLPlayer::render () const {
-    // only render while actively playing (m_handle is set by usage-count-driven play())
-    if (this->m_handle == nullptr) {
-	return;
-    }
+bool GLPlayer::pumpEvents (double timeout) const {
+    bool restarted = false;
 
 
     while (true) {
     while (true) {
-	const mpv_event* event = mpv_wait_event (this->m_handle, 0);
+	const mpv_event* event = mpv_wait_event (this->m_handle, timeout);
+
+	timeout = 0.0;
 
 
 	if (event == nullptr || event->event_id == MPV_EVENT_NONE) {
 	if (event == nullptr || event->event_id == MPV_EVENT_NONE) {
 	    break;
 	    break;
@@ -386,6 +399,7 @@ void GLPlayer::render () const {
 
 
 	if (event->event_id == MPV_EVENT_PLAYBACK_RESTART) {
 	if (event->event_id == MPV_EVENT_PLAYBACK_RESTART) {
 	    this->m_skipping = false;
 	    this->m_skipping = false;
+	    restarted = true;
 	    continue;
 	    continue;
 	}
 	}
 
 
@@ -465,8 +479,33 @@ void GLPlayer::render () const {
 	}
 	}
     }
     }
 
 
+    return restarted;
+}
+
+void GLPlayer::render () const {
+    // only render while actively playing (m_handle is set by usage-count-driven play())
+    if (this->m_handle == nullptr) {
+	return;
+    }
+
+    const bool stepped = fixedStep () > 0.0 && this->m_segments.empty ();
+
+    if (stepped) {
+	const auto loadDeadline = std::chrono::steady_clock::now () + std::chrono::seconds (10);
+
+	while (!this->m_fileLoaded && std::chrono::steady_clock::now () < loadDeadline) {
+	    this->pumpEvents (0.01);
+	}
+    }
+
+    this->pumpEvents (0.0);
+
     // mpv only hands out its next frame once the update flags were collected, without this playback stalls
     // mpv only hands out its next frame once the update flags were collected, without this playback stalls
-    const uint64_t updateFlags = mpv_render_context_update (this->m_renderContext);
+    uint64_t updateFlags = mpv_render_context_update (this->m_renderContext);
+
+    if (stepped) {
+	updateFlags |= this->stepToFrame ();
+    }
 
 
     if (this->m_doWeOwnFramebuffer) {
     if (this->m_doWeOwnFramebuffer) {
 	// WE's pause stops the thread that copies frames into the texture (sub_1400F3030), so a seek or stop while
 	// WE's pause stops the thread that copies frames into the texture (sub_1400F3030), so a seek or stop while
@@ -544,6 +583,30 @@ void GLPlayer::render () const {
     if (!collectStats) {
     if (!collectStats) {
 	mpv_render_context_render (this->m_renderContext, params);
 	mpv_render_context_render (this->m_renderContext, params);
 	resetUnpackState ();
 	resetUnpackState ();
+
+	if (stepped) {
+	    // one seek can queue more than one frame, the last of them is the sought one
+	    using Clock = std::chrono::steady_clock;
+
+	    // the first seeks of a file leave frames behind that arrive late
+	    const auto settle = std::chrono::milliseconds (this->m_stepCount++ < 3 ? 300 : 30);
+
+	    for (auto quiet = Clock::now () + settle; Clock::now () < quiet;) {
+		if (mpv_render_context_update (this->m_renderContext) & MPV_RENDER_UPDATE_FRAME) {
+		    mpv_render_frame_info info {};
+		    mpv_render_context_get_info (this->m_renderContext, { MPV_RENDER_PARAM_NEXT_FRAME_INFO, &info });
+
+		    if ((info.flags & MPV_RENDER_FRAME_INFO_PRESENT) && !(info.flags & MPV_RENDER_FRAME_INFO_REDRAW)) {
+			mpv_render_context_render (this->m_renderContext, params);
+			resetUnpackState ();
+			quiet = Clock::now () + settle;
+		    }
+		}
+
+		std::this_thread::sleep_for (std::chrono::milliseconds (1));
+	    }
+	}
+
 	return;
 	return;
     }
     }
 
 
@@ -555,6 +618,74 @@ void GLPlayer::render () const {
     s_statsMillis += std::chrono::duration<double, std::milli> (std::chrono::steady_clock::now () - start).count ();
     s_statsMillis += std::chrono::duration<double, std::milli> (std::chrono::steady_clock::now () - start).count ();
 }
 }
 
 
+uint64_t GLPlayer::stepToFrame () const {
+    if (!this->m_fileLoaded || this->m_paused) {
+	return 0;
+    }
+
+    double target = static_cast<double> (s_frame - this->m_stepOrigin) * fixedStep () * this->m_speed;
+
+    if (const double duration = this->getDuration (); duration > 0.0) {
+	target = this->m_loop ? std::fmod (target, duration) : std::min (target, duration);
+    }
+
+    const bool first = this->m_steppedTo < 0.0;
+
+    if (std::abs (target - std::max (this->m_steppedTo, 0.0)) < 1e-6 && !first) {
+	return 0;
+    }
+
+    uint64_t flags = 0;
+
+    if (!first || target > 1e-6) {
+	// events of an earlier seek must not pass for this one's
+	this->pumpEvents (0.0);
+	mpv_render_context_update (this->m_renderContext);
+
+	const std::string position = std::to_string (target);
+	const char* command[] = { "seek", position.c_str (), "absolute+exact", nullptr };
+
+	mpv_command (this->m_handle, command);
+
+	const double tolerance = std::max (this->m_frameDuration, 0.05);
+	const auto landDeadline = std::chrono::steady_clock::now () + std::chrono::seconds (2);
+	bool restarted = false;
+
+	while (std::chrono::steady_clock::now () < landDeadline) {
+	    restarted |= this->pumpEvents (0.005);
+
+	    if (restarted && std::abs (this->m_position - target) <= tolerance) {
+		break;
+	    }
+	}
+    }
+
+    this->m_steppedTo = target;
+
+    double barrier = 0.0;
+
+    mpv_get_property (this->m_handle, "time-pos", MPV_FORMAT_DOUBLE, &barrier);
+
+    // a redraw of the old picture raises the flag too, the sought frame is the one that is not a redraw
+    const auto deadline = std::chrono::steady_clock::now () + std::chrono::seconds (5);
+
+    while (std::chrono::steady_clock::now () < deadline) {
+	flags |= mpv_render_context_update (this->m_renderContext);
+
+	mpv_render_frame_info info {};
+	mpv_render_context_get_info (this->m_renderContext, { MPV_RENDER_PARAM_NEXT_FRAME_INFO, &info });
+
+	if ((flags & MPV_RENDER_UPDATE_FRAME) && (info.flags & MPV_RENDER_FRAME_INFO_PRESENT)
+	    && !(info.flags & MPV_RENDER_FRAME_INFO_REDRAW)) {
+	    break;
+	}
+
+	std::this_thread::sleep_for (std::chrono::milliseconds (1));
+    }
+
+    return flags;
+}
+
 int GLPlayer::getWidth () const { return this->m_width; }
 int GLPlayer::getWidth () const { return this->m_width; }
 int GLPlayer::getHeight () const { return this->m_height; }
 int GLPlayer::getHeight () const { return this->m_height; }
 
 
@@ -594,6 +725,8 @@ void GLPlayer::init () {
     this->m_ended = false;
     this->m_ended = false;
     this->m_skipping = false;
     this->m_skipping = false;
     this->m_position = 0.0;
     this->m_position = 0.0;
+    this->m_stepOrigin = s_frame;
+    this->m_steppedTo = -1.0;
     this->m_handle = mpv_create ();
     this->m_handle = mpv_create ();
 
 
     if (this->m_handle == nullptr) {
     if (this->m_handle == nullptr) {
@@ -686,7 +819,7 @@ void GLPlayer::init () {
     }
     }
 
 
     mpv_set_property_string (this->m_handle, "mute", this->m_muted ? "yes" : "no");
     mpv_set_property_string (this->m_handle, "mute", this->m_muted ? "yes" : "no");
-    this->m_enginePaused = this->m_paused;
+    this->m_enginePaused = this->m_paused || fixedStep () > 0.0;
     mpv_set_property_string (this->m_handle, "pause", this->m_enginePaused ? "yes" : "no");
     mpv_set_property_string (this->m_handle, "pause", this->m_enginePaused ? "yes" : "no");
 }
 }
 
 

+ 8 - 0
src/WallpaperEngine/VideoPlayback/MPV/GLPlayer.h

@@ -87,6 +87,11 @@ private:
     void observePosition () const;
     void observePosition () const;
     std::optional<double> skipTarget (double position) const;
     std::optional<double> skipTarget (double position) const;
     void init ();
     void init ();
+    /** seeks to this scene frame's video time and waits for mpv's frame, the flags mpv_render_context_update gave
+     * meanwhile */
+    uint64_t stepToFrame () const;
+    /** handles what mpv has queued, waiting up to timeout seconds for the first event; true when a seek finished */
+    bool pumpEvents (double timeout) const;
     void applyPause () const;
     void applyPause () const;
     void play ();
     void play ();
     void setSource (MemoryStreamProtocolUniquePtr source);
     void setSource (MemoryStreamProtocolUniquePtr source);
@@ -126,6 +131,9 @@ protected:
     mutable VideoSegments m_segments;
     mutable VideoSegments m_segments;
     /** positions reported until it lands are stale */
     /** positions reported until it lands are stale */
     mutable bool m_skipping = false;
     mutable bool m_skipping = false;
+    uint64_t m_stepOrigin = 0;
+    mutable double m_steppedTo = -1.0;
+    mutable int m_stepCount = 0;
     mutable double m_frameDuration = 0.0;
     mutable double m_frameDuration = 0.0;
     std::optional<std::filesystem::path> m_file;
     std::optional<std::filesystem::path> m_file;
     std::optional<MemoryStreamProtocolUniquePtr> m_stream;
     std::optional<MemoryStreamProtocolUniquePtr> m_stream;

+ 2 - 1
tools/linuxvm/RELEASE_TESTING.md

@@ -173,7 +173,8 @@ All of it lives in `tools/linuxvm/`:
   focus), `check_frame.py` (black/flat/unchanged/hotswap differs, and `--reference` against `reference/<id>.png`: upside down, mirrored or another crop; Pillow, run with `-I`). `make_reference_frames.sh` renders those references headlessly from the payload (video wallpapers have none). On X11 sessions `guest_test.sh` also runs a `windowbg` group (`--window --window-background` on the output's geometry).
   focus), `check_frame.py` (black/flat/unchanged/hotswap differs, and `--reference` against `reference/<id>.png`: upside down, mirrored or another crop; Pillow, run with `-I`). `make_reference_frames.sh` renders those references headlessly from the payload (video wallpapers have none). On X11 sessions `guest_test.sh` also runs a `windowbg` group (`--window --window-background` on the output's geometry).
 - `clean_install_check.sh` (a first install of the prebuilt engine through we_manager), `wem_check.sh` (we_manager install,
 - `clean_install_check.sh` (a first install of the prebuilt engine through we_manager), `wem_check.sh` (we_manager install,
   launch, stop, kill all, autostart entry), `update_check.sh` (`fake_github.py` serving a newer app .deb, `bump_deb.py`, and the
   launch, stop, kill all, autostart entry), `update_check.sh` (`fake_github.py` serving a newer app .deb, `bump_deb.py`, and the
-  candidate engine as a newer release), `deps_check.sh` (the "install build dependencies" button on the VM's package manager,
+  candidate engine as a newer release, plus an older release of each and a `libnode-arch` helper release: manual check with the
+  automatic checks off, close against "don't notify me again", the version picker's list, engine and .deb downgrades), `deps_check.sh` (the "install build dependencies" button on the VM's package manager,
   then the engine's CMake configure on the source tarball), `autostart_check.sh` (a one wallpaper autostart playlist, a real
   then the engine's CMake configure on the source tarball), `autostart_check.sh` (a one wallpaper autostart playlist, a real
   reboot, we_manager and the engine back; wallpapers only come back through the autostart playlist, a wallpaper launched by hand
   reboot, we_manager and the engine back; wallpapers only come back through the autostart playlist, a wallpaper launched by hand
   is not restored), `flatpak_check.sh` (bundle install, scene + web wallpaper, stop, kill all, autostart entry).
   is not restored), `flatpak_check.sh` (bundle install, scene + web wallpaper, stop, kill all, autostart entry).

+ 29 - 11
tools/linuxvm/fake_github.py

@@ -3,10 +3,13 @@
 
 
     fake_github.py <dir> [--release REPO=TAG:FILE[,FILE...]]... [--port 443]
     fake_github.py <dir> [--release REPO=TAG:FILE[,FILE...]]... [--port 443]
 
 
+A repo can have several --release options, newest first (the first one is its "latest"). A tag starting with "!" is only
+listed, never "latest" (a helper release like libnode-arch, or a pre-release).
+
 <dir> gets a CA and a certificate for api.github.com on the first run (ca.pem, cert.pem, key.pem; needs openssl, OPENSSL names another binary, openssl_proot.sh is used when there is none).
 <dir> gets a CA and a certificate for api.github.com on the first run (ca.pem, cert.pem, key.pem; needs openssl, OPENSSL names another binary, openssl_proot.sh is used when there is none).
 The VM resolves api.github.com to this server (/etc/hosts) and trusts ca.pem, e.g. NODE_EXTRA_CA_CERTS for
 The VM resolves api.github.com to this server (/etc/hosts) and trusts ca.pem, e.g. NODE_EXTRA_CA_CERTS for
-Electron's main process. GET /repos/<REPO>/releases/latest answers with the release given for it (assets with size
-and a sha256 digest like GitHub's, downloaded from this server), every other repo with 404. Requests are logged to
+Electron's main process. GET /repos/<REPO>/releases/latest, /releases?per_page=N and /releases/tags/<TAG> answer with the releases given for it
+(assets with size and a sha256 digest like GitHub's, downloaded from this server), every other repo with 404. Requests are logged to
 stdout.
 stdout.
 """
 """
 import argparse
 import argparse
@@ -18,6 +21,7 @@ import shutil
 import ssl
 import ssl
 import subprocess
 import subprocess
 import sys
 import sys
+import urllib.parse
 from pathlib import Path
 from pathlib import Path
 
 
 HOST = "api.github.com"
 HOST = "api.github.com"
@@ -39,8 +43,10 @@ def make_certificate(folder):
             "-extfile", "ext.cnf", "-out", "cert.pem")
             "-extfile", "ext.cnf", "-out", "cert.pem")
 
 
 
 
-def release(repo, spec):
+def release(repo, spec, age):
     tag, _, files = spec.partition(":")
     tag, _, files = spec.partition(":")
+    listed_only = tag.startswith("!")
+    tag = tag.lstrip("!")
     assets = []
     assets = []
     for name in filter(None, files.split(",")):
     for name in filter(None, files.split(",")):
         path = Path(name).resolve()
         path = Path(name).resolve()
@@ -48,7 +54,13 @@ def release(repo, spec):
         assets.append({"name": path.name, "size": path.stat().st_size, "digest": f"sha256:{digest}",
         assets.append({"name": path.name, "size": path.stat().st_size, "digest": f"sha256:{digest}",
                        "browser_download_url": f"https://{HOST}/download/{tag}/{path.name}", "path": str(path)})
                        "browser_download_url": f"https://{HOST}/download/{tag}/{path.name}", "path": str(path)})
     return {"tag_name": tag, "html_url": f"https://github.com/{repo}/releases/tag/{tag}", "body": f"Test release {tag}",
     return {"tag_name": tag, "html_url": f"https://github.com/{repo}/releases/tag/{tag}", "body": f"Test release {tag}",
-            "published_at": "2026-10-15T12:00:00Z", "assets": assets}
+            "published_at": f"2026-10-{15 - age:02d}T12:00:00Z", "draft": False, "prerelease": False,
+            "listed_only": listed_only, "assets": assets}
+
+
+def public(entry):
+    return {**{key: value for key, value in entry.items() if key != "listed_only"},
+            "assets": [{key: value for key, value in asset.items() if key != "path"} for asset in entry["assets"]]}
 
 
 
 
 def main():
 def main():
@@ -62,9 +74,9 @@ def main():
     releases = {}
     releases = {}
     for item in args.release:
     for item in args.release:
         repo, _, spec = item.partition("=")
         repo, _, spec = item.partition("=")
-        releases[repo] = release(repo, spec)
+        releases.setdefault(repo, []).append(release(repo, spec, len(releases.get(repo, []))))
     files = {f"/download/{entry['tag_name']}/{asset['name']}": asset["path"]
     files = {f"/download/{entry['tag_name']}/{asset['name']}": asset["path"]
-             for entry in releases.values() for asset in entry["assets"]}
+             for entries in releases.values() for entry in entries for asset in entry["assets"]}
 
 
     class Handler(http.server.BaseHTTPRequestHandler):
     class Handler(http.server.BaseHTTPRequestHandler):
         def do_GET(self):
         def do_GET(self):
@@ -77,12 +89,18 @@ def main():
                 self.end_headers()
                 self.end_headers()
                 self.wfile.write(data)
                 self.wfile.write(data)
                 return
                 return
-            parts = self.path.strip("/").split("/")
+            parts = urllib.parse.urlsplit(self.path).path.strip("/").split("/")
             repo = "/".join(parts[1:3])
             repo = "/".join(parts[1:3])
-            if parts[:1] == ["repos"] and parts[3:] == ["releases", "latest"] and repo in releases:
-                body = json.dumps({**releases[repo], "assets": [
-                    {key: value for key, value in asset.items() if key != "path"} for asset in releases[repo]["assets"]
-                ]}).encode()
+            entries = releases.get(repo, []) if parts[:1] == ["repos"] else []
+            found = None
+            if parts[3:] == ["releases", "latest"]:
+                found = next((entry for entry in entries if not entry["listed_only"]), None)
+            elif parts[3:] == ["releases"]:
+                found = [public(entry) for entry in entries] if entries else None
+            elif parts[3:5] == ["releases", "tags"] and len(parts) == 6:
+                found = next((entry for entry in entries if entry["tag_name"] == urllib.parse.unquote(parts[5])), None)
+            if found is not None:
+                body = json.dumps(found if isinstance(found, list) else public(found)).encode()
                 self.send_response(200)
                 self.send_response(200)
             else:
             else:
                 body = b'{"message": "Not Found"}'
                 body = b'{"message": "Not Found"}'

+ 47 - 3
tools/linuxvm/update_check.sh

@@ -3,7 +3,9 @@
 # this host: an app release (the candidate's .deb with a newer Version) and an engine release (the portable tarball under
 # this host: an app release (the candidate's .deb with a newer Version) and an engine release (the portable tarball under
 # a newer tag). Checks that both updates are offered, the engine update installs, and for a .deb install that the app
 # a newer tag). Checks that both updates are offered, the engine update installs, and for a .deb install that the app
 # update downloads, installs through polkit (a rule for the lab user stands in for the dialog) and the package version
 # update downloads, installs through polkit (a rule for the lab user stands in for the dialog) and the package version
-# changes. Other install kinds (an unpacked AppImage, Flatpak) are expected to only get the notice. Needs the session
+# changes. Also: a manual "check now" with the automatic checks off, "close" (until the next start) against "don't notify
+# again" (kept), the version picker's list (only v-tagged releases, a libnode-arch helper release is left out) and going back
+# to an older engine (prebuilt) and app (.deb) release. Other install kinds (an unpacked AppImage, Flatpak) are expected to only get the notice. Needs the session
 # running (sessenv) and the candidate's we_manager unpacked/installed the way wem_check.sh does.
 # running (sessenv) and the candidate's we_manager unpacked/installed the way wem_check.sh does.
 #   APP_DEB       .deb to serve as the new app release (default: the one next to the app dir's dist folder)
 #   APP_DEB       .deb to serve as the new app release (default: the one next to the app dir's dist folder)
 #   ENGINE_TARBALL portable engine tarball to serve (default ~/.local/share/distro-rootfs/out/linux-wallpaperengine-kde-portable-x86_64.tar.gz)
 #   ENGINE_TARBALL portable engine tarball to serve (default ~/.local/share/distro-rootfs/out/linux-wallpaperengine-kde-portable-x86_64.tar.gz)
@@ -17,6 +19,7 @@ cdp() { sshv ". ~/sessenv; cd ~/wem; NODE_EXTRA_CA_CERTS= timeout ${CDP_TIMEOUT:
 
 
 work=$(mktemp -d)
 work=$(mktemp -d)
 engine_tag=v99.0.$(date +%s)   # newer than whatever engine the VM has, a golden disk may hold an earlier run's
 engine_tag=v99.0.$(date +%s)   # newer than whatever engine the VM has, a golden disk may hold an earlier run's
+engine_old=v98.0.${engine_tag##*.}
 deb=${APP_DEB:-}
 deb=${APP_DEB:-}
 if [ -z "$deb" ]; then
 if [ -z "$deb" ]; then
     for candidate in "$(dirname "$app")"/*.deb "$(dirname "$app")"/../*.deb; do [ -f "$candidate" ] && deb=$candidate && break; done
     for candidate in "$(dirname "$app")"/*.deb "$(dirname "$app")"/../*.deb; do [ -f "$candidate" ] && deb=$candidate && break; done
@@ -25,17 +28,22 @@ engine=${ENGINE_TARBALL:-$HOME/.local/share/distro-rootfs/out/linux-wallpapereng
 app_release=()
 app_release=()
 if [ -f "$deb" ]; then
 if [ -f "$deb" ]; then
     python3 "$HERE/bump_deb.py" "$deb" "$work/we-manager_0.9.9_amd64.deb" 0.9.9
     python3 "$HERE/bump_deb.py" "$deb" "$work/we-manager_0.9.9_amd64.deb" 0.9.9
-    app_release=(--release "WallpaperEngineLover/we_manager=v0.9.9:$work/we-manager_0.9.9_amd64.deb")
+    python3 "$HERE/bump_deb.py" "$deb" "$work/we-manager_0.9.7_amd64.deb" 0.9.7
+    app_release=(--release "WallpaperEngineLover/we_manager=v0.9.9:$work/we-manager_0.9.9_amd64.deb"
+                 --release "WallpaperEngineLover/we_manager=v0.9.7:$work/we-manager_0.9.7_amd64.deb")
 else
 else
     echo "SKIP app update: no .deb to serve as the new app release (APP_DEB), only the engine update is checked"
     echo "SKIP app update: no .deb to serve as the new app release (APP_DEB), only the engine update is checked"
 fi
 fi
 cp "$engine" "$work/linux-wallpaperengine-kde-portable-x86_64.tar.gz"
 cp "$engine" "$work/linux-wallpaperengine-kde-portable-x86_64.tar.gz"
 cp "$engine" "$work/linux-wallpaperengine-generic-portable-x86_64.tar.gz"
 cp "$engine" "$work/linux-wallpaperengine-generic-portable-x86_64.tar.gz"
+echo helper > "$work/libnode-arch.pkg.tar.zst"
 mkdir -p "$work/certs"
 mkdir -p "$work/certs"
 . "$HERE/fake_github_lib.sh"
 . "$HERE/fake_github_lib.sh"
 fgh_start "$vm" "$work" \
 fgh_start "$vm" "$work" \
     "${app_release[@]}" \
     "${app_release[@]}" \
-    --release "WallpaperEngineLover/linux-wallpaperengine-kde=$engine_tag:$work/linux-wallpaperengine-kde-portable-x86_64.tar.gz,$work/linux-wallpaperengine-generic-portable-x86_64.tar.gz"
+    --release "WallpaperEngineLover/linux-wallpaperengine-kde=$engine_tag:$work/linux-wallpaperengine-kde-portable-x86_64.tar.gz,$work/linux-wallpaperengine-generic-portable-x86_64.tar.gz" \
+    --release "WallpaperEngineLover/linux-wallpaperengine-kde=!libnode-arch:$work/libnode-arch.pkg.tar.zst" \
+    --release "WallpaperEngineLover/linux-wallpaperengine-kde=$engine_old:$work/linux-wallpaperengine-kde-portable-x86_64.tar.gz,$work/linux-wallpaperengine-generic-portable-x86_64.tar.gz"
 trap 'kill $fake 2>/dev/null; rm -rf "$work"' EXIT
 trap 'kill $fake 2>/dev/null; rm -rf "$work"' EXIT
 sleep 3
 sleep 3
 kill -0 $fake 2>/dev/null || { cat "$work/fake.log"; echo "fake_github did not start (port 443?)"; exit 2; }
 kill -0 $fake 2>/dev/null || { cat "$work/fake.log"; echo "fake_github did not start (port 443?)"; exit 2; }
@@ -60,6 +68,14 @@ if [[ $app == *.deb ]]; then start="${WEM_LAUNCH:-} we-manager ${WEM_FLAGS:-}";
 sshv ". ~/sessenv; export NODE_EXTRA_CA_CERTS=\$HOME/wem/fake-ca.pem; (setsid nohup $start --remote-debugging-port=9222 > ~/wem/app-update.log 2>&1 </dev/null &); for _ in \$(seq 40); do grep -q 'DevTools listening' ~/wem/app-update.log 2>/dev/null && break; sleep 1; done; sleep 8"
 sshv ". ~/sessenv; export NODE_EXTRA_CA_CERTS=\$HOME/wem/fake-ca.pem; (setsid nohup $start --remote-debugging-port=9222 > ~/wem/app-update.log 2>&1 </dev/null &); for _ in \$(seq 40); do grep -q 'DevTools listening' ~/wem/app-update.log 2>/dev/null && break; sleep 1; done; sleep 8"
 [ "$(sshv 'pgrep -fc "[w]e-manager"')" -gt 0 ] && pass "we_manager starts" || { fail "we_manager did not start: $(sshv 'tail -3 ~/wem/app-update.log')"; exit 1; }
 [ "$(sshv 'pgrep -fc "[w]e-manager"')" -gt 0 ] && pass "we_manager starts" || { fail "we_manager did not start: $(sshv 'tail -3 ~/wem/app-update.log')"; exit 1; }
 
 
+val() { cdp "$1" 400 | tr -d '"'; }
+cdp 'window.electronAPI.updates.setChecks({app: false, engine: false})' 300 >/dev/null
+sleep 3
+manual=$(val "window.electronAPI.updates.check().then(s => [s.app && s.app.version, s.checked.app, s.checked.engine].join(' '))")
+want="v0.9.9 true true"
+[ -f "$deb" ] || want=" true true"
+[ "$manual" = "$want" ] && pass "manual check with automatic checks off looked at everything ($manual)" || fail "manual check with automatic checks off: '$manual', wanted '$want'"
+
 out=$(cdp 'window.electronAPI.updates.setChecks({app: true, engine: true})' 1500)
 out=$(cdp 'window.electronAPI.updates.setChecks({app: true, engine: true})' 1500)
 out=$(cdp 'window.electronAPI.updates.check()' 2500); echo "     $out" | tr '\n' ' ' | cut -c1-600; echo
 out=$(cdp 'window.electronAPI.updates.check()' 2500); echo "     $out" | tr '\n' ' ' | cut -c1-600; echo
 kind=$(echo "$out" | grep -o '"appInstall": "[^"]*"' | cut -d'"' -f4)
 kind=$(echo "$out" | grep -o '"appInstall": "[^"]*"' | cut -d'"' -f4)
@@ -70,6 +86,20 @@ if echo "$out" | grep -q "$engine_tag"; then pass "engine update $engine_tag off
 elif echo "$out" | grep -q '"engineInstall": null'; then echo "SKIP engine update offer: no engine installed through we_manager on this VM yet"
 elif echo "$out" | grep -q '"engineInstall": null'; then echo "SKIP engine update offer: no engine installed through we_manager on this VM yet"
 else fail "engine update not offered"; fi
 else fail "engine update not offered"; fi
 
 
+r=$(val "window.electronAPI.updates.dismiss('app', 'v0.9.9', false).then(s => [s.snoozed.app, s.dismissed.app].join('|'))")
+[ "$r" = "v0.9.9|" ] && pass "closing a notice only snoozes it" || fail "close: '$r'"
+r=$(val "window.electronAPI.updates.dismiss('app', 'v0.9.9', true).then(s => s.dismissed.app)")
+[ "$r" = v0.9.9 ] && pass "don't notify me again keeps the version dismissed" || fail "dismiss for good: '$r'"
+r=$(val "window.electronAPI.updates.check().then(s => Object.keys(s.dismissed).length + '/' + Object.keys(s.snoozed).length)")
+[ "$r" = 0/0 ] && pass "check now brings dismissed notices back" || fail "check now after dismissing: '$r'"
+
+r=$(val "window.electronAPI.updates.versions('engine').then(v => v.map(x => x.tag).join(' '))")
+if [[ $r == *"$engine_tag"* && $r == *"$engine_old"* && $r != *libnode* ]]; then pass "engine versions listed without the libnode release ($r)"; else fail "engine versions: '$r'"; fi
+if [ -f "$deb" ]; then
+    r=$(val "window.electronAPI.updates.versions('app').then(v => v.map(x => x.tag).join(' '))")
+    [ "$r" = "v0.9.9 v0.9.7" ] && pass "app versions listed newest first ($r)" || fail "app versions: '$r'"
+fi
+
 if [ "$kind" = deb ]; then
 if [ "$kind" = deb ]; then
     out=$(cdp 'window.electronAPI.updates.installApp()' 1500); sleep 20
     out=$(cdp 'window.electronAPI.updates.installApp()' 1500); sleep 20
     version=$(sshv 'dpkg-query -W -f="\${Version}" we-manager 2>/dev/null')
     version=$(sshv 'dpkg-query -W -f="\${Version}" we-manager 2>/dev/null')
@@ -87,6 +117,20 @@ for _ in 1 2 3; do
     sleep 20
     sleep 20
 done
 done
 if echo "$out" | grep -q '"installed": true'; then pass "engine update installed through the prebuilt install: $(echo "$out" | grep -o '"version": "[^"]*"')"; else fail "engine update failed: $out"; fi
 if echo "$out" | grep -q '"installed": true'; then pass "engine update installed through the prebuilt install: $(echo "$out" | grep -o '"version": "[^"]*"')"; else fail "engine update failed: $out"; fi
+
+# the .deb needs apt's --allow-downgrades to go back
+if echo "$out" | grep -q '"installed": true'; then
+    out=$(sshv ". ~/sessenv; cd ~/wem; timeout 400 python3 cdp.py \"window.electronAPI.lwe.installPrebuilt('$engine_old')\" 2>&1 | cut -c1-300")
+    echo "$out" | grep -q "\"version\": \"$engine_old\"" && pass "engine went back to $engine_old" || fail "engine downgrade to $engine_old: $out"
+    out=$(sshv ". ~/sessenv; cd ~/wem; timeout 400 python3 cdp.py \"window.electronAPI.lwe.installPrebuilt('libnode-arch')\" 2>&1 | cut -c1-300")
+    echo "$out" | grep -q "\"version\": \"$engine_old\"" && pass "a non-version release is refused, the engine stays on $engine_old" || fail "libnode-arch changed the engine: $out"
+fi
+if [ "$kind" = deb ]; then
+    for _ in $(seq 30); do [ "$(cdp '1 + 1' 20)" = 2 ] && break; sleep 3; done
+    out=$(cdp "window.electronAPI.updates.installApp('v0.9.7')" 1500); sleep 20
+    version=$(sshv 'dpkg-query -W -f="\${Version}" we-manager 2>/dev/null')
+    [ "$version" = 0.9.7 ] && pass "the .deb went back to 0.9.7" || fail "after installApp('v0.9.7') the package is $version: $out"
+fi
 grep -c "GET" "$work/fake.log" | xargs -I{} echo "     {} requests reached the fake api.github.com"
 grep -c "GET" "$work/fake.log" | xargs -I{} echo "     {} requests reached the fake api.github.com"
 sshv 'pkill -f "[w]e-manager" 2>/dev/null; for _ in $(seq 20); do pgrep -f "[w]e-manager" >/dev/null || break; sleep 1; done; sudo rm -f /etc/polkit-1/rules.d/49-lab-test.rules; sudo sed -i "/api.github.com/d" /etc/hosts; true'
 sshv 'pkill -f "[w]e-manager" 2>/dev/null; for _ in $(seq 20); do pgrep -f "[w]e-manager" >/dev/null || break; sleep 1; done; sudo rm -f /etc/polkit-1/rules.d/49-lab-test.rules; sudo sed -i "/api.github.com/d" /etc/hosts; true'
 exit $status
 exit $status

+ 8 - 2
tools/package_release.sh

@@ -35,10 +35,16 @@ cmake --install "$build_dir" --prefix "$work/install" >/dev/null
 pkg="$work/$name"
 pkg="$work/$name"
 mkdir -p "$pkg"
 mkdir -p "$pkg"
 cd "$work/install"
 cd "$work/install"
-cp -a linux-wallpaperengine linux-wallpaperengine-web-helper liblinux-wallpaperengine-lib.so libcef.so libEGL.so \
-    libGLESv2.so libvk_swiftshader.so vk_swiftshader_icd.json chrome-sandbox icudtl.dat v8_context_snapshot.bin \
+cp -a linux-wallpaperengine linux-wallpaperengine-web-helper liblinux-wallpaperengine-lib.so libcef.so libvk_swiftshader.so vk_swiftshader_icd.json chrome-sandbox icudtl.dat v8_context_snapshot.bin \
     ./*.pak locales gnome-shell-extension "$pkg/"
     ./*.pak locales gnome-shell-extension "$pkg/"
 
 
+# CEF before 156 ships its own ANGLE libraries, newer builds link them into libcef.so
+for lib in libEGL.so libGLESv2.so; do
+    if [ -e "$lib" ]; then
+        cp -a "$lib" "$pkg/"
+    fi
+done
+
 # programs of ours next to the engine: Chromium's child processes, and (builds with the KDE integration) the one that
 # programs of ours next to the engine: Chromium's child processes, and (builds with the KDE integration) the one that
 # unloads the engine's KWin scripts when it is killed
 # unloads the engine's KWin scripts when it is killed
 helpers=(linux-wallpaperengine-web-helper)
 helpers=(linux-wallpaperengine-web-helper)

+ 3 - 1
tools/regression/regress.py

@@ -18,7 +18,9 @@ compare looks at four things per wallpaper: whether it still renders (crash/time
 lines that appear or disappear in the log, how much of the screenshot changed, and whether gif
 lines that appear or disappear in the log, how much of the screenshot changed, and whether gif
 and video textures still move (wallpapers shipping them get a second render a few frames later,
 and video textures still move (wallpapers shipping them get a second render a few frames later,
 a hidden or frozen one shows up as less motion). Video textures play in real time and never
 a hidden or frozen one shows up as less motion). Video textures play in real time and never
-render the same twice, --repeat 2 on the base run marks those pixels so compare ignores them.
+render the same twice, --repeat 2 on the base run marks those pixels so compare ignores them. A build that
+steps video textures under LWE_FIXED_TIMESTEP (every scene frame seeks them to its own time) renders them the same
+every time, so compare two such builds without relying on that mask.
 It writes an HTML report with side-by-sides of everything flagged and exits 1 if anything
 It writes an HTML report with side-by-sides of everything flagged and exits 1 if anything
 regressed. Both builds need LWE_FIXED_TIMESTEP support, older ones render every run differently.
 regressed. Both builds need LWE_FIXED_TIMESTEP support, older ones render every run differently.