diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2023-03-24 10:21:38 +0100 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2023-04-20 14:49:38 +0200 |
commit | 2325022d2fa9600bcce108ad96734d4cc5d0cb23 (patch) | |
tree | 7e469e8f1ea253f1686ee89df5c837b839774028 | |
parent | ff705fa9023ce7663f516b8ce24ae860220d6ef9 (diff) | |
download | gnome-shell-2325022d2fa9600bcce108ad96734d4cc5d0cb23.tar.gz |
scripting: Allow avoiding exiting perf helper
This will help creating test cases where windows are open during
shutdown.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
-rw-r--r-- | js/ui/scripting.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/js/ui/scripting.js b/js/ui/scripting.js index 4034d2105..f988d53f9 100644 --- a/js/ui/scripting.js +++ b/js/ui/scripting.js @@ -1,7 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- /* exported sleep, waitLeisure, createTestWindow, waitTestWindows, destroyTestWindows, defineScriptEvent, scriptEvent, - collectStatistics, runPerfScript */ + collectStatistics, runPerfScript, disableHelperAutoExit */ const { Gio, GLib, Meta, Shell } = imports.gi; @@ -70,8 +70,10 @@ function PerfHelper() { let _perfHelper = null; function _getPerfHelper() { - if (_perfHelper == null) + if (_perfHelper == null) { _perfHelper = new PerfHelper(); + _perfHelper._autoExit = true; + } return _perfHelper; } @@ -141,6 +143,17 @@ function destroyTestWindows() { } /** + * disableHelperAutoExit: + * + * Don't exixt the perf helper after running the script. Instead it will remain + * running until something else makes it exit, e.g. the Wayland socket closing. + */ +function disableHelperAutoExit() { + let perfHelper = _getPerfHelper(); + perfHelper._autoExit = false; +} + +/** * defineScriptEvent * @param {string} name: The event will be called script.<name> * @param {string} description: Short human-readable description of the event @@ -287,7 +300,8 @@ async function _runPerfScript(scriptModule, outputFile) { try { const perfHelper = _getPerfHelper(); - perfHelper.ExitSync(); + if (perfHelper._autoExit) + perfHelper.ExitSync(); } catch (err) { log(`Failed to exit helper: ${err}\n${err.stack}`); Meta.exit(Meta.ExitCode.ERROR); |