From db3e2167047a27f8152ed7f0dd6777f1ae5d3e40 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 17 Jun 2024 13:41:17 -0400 Subject: [PATCH 1/4] test that installers do not exit immediately --- .github/workflows/build-linux-installer-deb.yml | 2 +- .github/workflows/build-linux-installer-rpm.yml | 2 +- .github/workflows/build-macos-installers.yml | 2 +- .github/workflows/build-windows-installer.yml | 2 +- chia/cmds/installers.py | 16 ++++++++++++++-- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-linux-installer-deb.yml b/.github/workflows/build-linux-installer-deb.yml index de813fac016c..5c78e37245b9 100644 --- a/.github/workflows/build-linux-installer-deb.yml +++ b/.github/workflows/build-linux-installer-deb.yml @@ -423,7 +423,7 @@ jobs: - name: Run chia dev installers test run: | - chia dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" + chia dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command chia-blockchain - name: Verify /opt/chia present run: | diff --git a/.github/workflows/build-linux-installer-rpm.yml b/.github/workflows/build-linux-installer-rpm.yml index c8ed3c75b5fc..a2d22dc64b2d 100644 --- a/.github/workflows/build-linux-installer-rpm.yml +++ b/.github/workflows/build-linux-installer-rpm.yml @@ -420,7 +420,7 @@ jobs: - name: Run chia dev installers test run: | - chia dev installers test --require-no-madmax --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" + chia dev installers test --require-no-madmax --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command chia-blockchain - name: Verify /opt/chia present run: | diff --git a/.github/workflows/build-macos-installers.yml b/.github/workflows/build-macos-installers.yml index b5f4bc8d2e42..264a7ed48574 100644 --- a/.github/workflows/build-macos-installers.yml +++ b/.github/workflows/build-macos-installers.yml @@ -457,7 +457,7 @@ jobs: - name: Run chia dev installers test run: | - "/Volumes/Chia "*"/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia" dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" + "/Volumes/Chia "*"/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia" dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command open --gui-command "/Volumes/Chia "*/Chia.app - name: Detach .dmg if: always() diff --git a/.github/workflows/build-windows-installer.yml b/.github/workflows/build-windows-installer.yml index c63e0b0b1c42..58352cd44c17 100644 --- a/.github/workflows/build-windows-installer.yml +++ b/.github/workflows/build-windows-installer.yml @@ -434,4 +434,4 @@ jobs: env: INSTALL_PATH: ${{ github.workspace }}\installed run: | - & ($env:INSTALL_PATH + "\resources\app.asar.unpacked\daemon\chia.exe") dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" + & ($env:INSTALL_PATH + "\resources\app.asar.unpacked\daemon\chia.exe") dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command ($env:INSTALL_PATH + "\Chia.exe") diff --git a/chia/cmds/installers.py b/chia/cmds/installers.py index 8ffed570146c..58a3a197d803 100644 --- a/chia/cmds/installers.py +++ b/chia/cmds/installers.py @@ -3,7 +3,7 @@ import json import subprocess import tempfile -from typing import Dict, List, Optional +from typing import Dict, List, Optional, Sequence import click import packaging.version @@ -50,7 +50,8 @@ def installers_group() -> None: @installers_group.command(name="test") @click.option("--expected-chia-version", "expected_chia_version_str", required=True) @click.option("--require-madmax/--require-no-madmax", "require_madmax", default=True) -def test_command(expected_chia_version_str: str, require_madmax: bool) -> None: +@click.option("--gui-command", multiple=True, required=True) +def test_command(expected_chia_version_str: str, require_madmax: bool, gui_command: Sequence[str]) -> None: print("testing installed executables") expected_chia_version = packaging.version.Version(expected_chia_version_str) @@ -127,3 +128,14 @@ def test_command(expected_chia_version_str: str, require_madmax: bool) -> None: check=True, timeout=adjusted_timeout(30), ) + + try: + subprocess.run( + args=gui_command, + check=True, + timeout=adjusted_timeout(30), + ) + except subprocess.TimeoutExpired: + pass + else: + raise Exception("process terminated prior to timeout") From 93cc7c7773dab5ddbd920bcbdd59a57d4dbbeca6 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 17 Jun 2024 13:51:44 -0400 Subject: [PATCH 2/4] only for gui mode testing --- .../workflows/build-linux-installer-deb.yml | 6 +++-- .../workflows/build-linux-installer-rpm.yml | 2 +- chia/cmds/installers.py | 23 ++++++++++--------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-linux-installer-deb.yml b/.github/workflows/build-linux-installer-deb.yml index 5c78e37245b9..dfeb1d722121 100644 --- a/.github/workflows/build-linux-installer-deb.yml +++ b/.github/workflows/build-linux-installer-deb.yml @@ -382,9 +382,11 @@ jobs: url: "docker://ubuntu:noble" mode: - name: GUI + matrix: gui file: chia-blockchain_*.deb package: chia-blockchain - name: CLI + matrix: cli file: chia-blockchain-cli_*.deb package: chia-blockchain-cli arch: @@ -423,7 +425,7 @@ jobs: - name: Run chia dev installers test run: | - chia dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command chia-blockchain + chia dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" ${{ matrix.mode.matrix == 'gui' && '--gui-command chia-blockchain' || '' }} - name: Verify /opt/chia present run: | @@ -435,7 +437,7 @@ jobs: - name: Check permissions of /opt/chia/chrome-sandbox shell: bash - if: matrix.mode.name == 'GUI' + if: matrix.mode.matrix == 'gui' run: | [ $(stat -c %a:%G:%U /opt/chia/chrome-sandbox) == "4755:root:root" ] diff --git a/.github/workflows/build-linux-installer-rpm.yml b/.github/workflows/build-linux-installer-rpm.yml index a2d22dc64b2d..5e0a8d6e500e 100644 --- a/.github/workflows/build-linux-installer-rpm.yml +++ b/.github/workflows/build-linux-installer-rpm.yml @@ -420,7 +420,7 @@ jobs: - name: Run chia dev installers test run: | - chia dev installers test --require-no-madmax --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command chia-blockchain + chia dev installers test --require-no-madmax --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" ${{ matrix.mode.matrix == 'gui' && '--gui-command chia-blockchain' || '' }} - name: Verify /opt/chia present run: | diff --git a/chia/cmds/installers.py b/chia/cmds/installers.py index 58a3a197d803..e753a07da742 100644 --- a/chia/cmds/installers.py +++ b/chia/cmds/installers.py @@ -50,7 +50,7 @@ def installers_group() -> None: @installers_group.command(name="test") @click.option("--expected-chia-version", "expected_chia_version_str", required=True) @click.option("--require-madmax/--require-no-madmax", "require_madmax", default=True) -@click.option("--gui-command", multiple=True, required=True) +@click.option("--gui-command", multiple=True) def test_command(expected_chia_version_str: str, require_madmax: bool, gui_command: Sequence[str]) -> None: print("testing installed executables") expected_chia_version = packaging.version.Version(expected_chia_version_str) @@ -129,13 +129,14 @@ def test_command(expected_chia_version_str: str, require_madmax: bool, gui_comma timeout=adjusted_timeout(30), ) - try: - subprocess.run( - args=gui_command, - check=True, - timeout=adjusted_timeout(30), - ) - except subprocess.TimeoutExpired: - pass - else: - raise Exception("process terminated prior to timeout") + if len(gui_command) > 0: + try: + subprocess.run( + args=gui_command, + check=True, + timeout=adjusted_timeout(30), + ) + except subprocess.TimeoutExpired: + pass + else: + raise Exception("process terminated prior to timeout") From aee04b8f533bef3719c0fb43624cae55eab7ad56 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 17 Jun 2024 14:17:03 -0400 Subject: [PATCH 3/4] print _something_ --- chia/cmds/installers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chia/cmds/installers.py b/chia/cmds/installers.py index e753a07da742..35071cb1aa1d 100644 --- a/chia/cmds/installers.py +++ b/chia/cmds/installers.py @@ -2,6 +2,7 @@ import json import subprocess +import sys import tempfile from typing import Dict, List, Optional, Sequence @@ -129,7 +130,11 @@ def test_command(expected_chia_version_str: str, require_madmax: bool, gui_comma timeout=adjusted_timeout(30), ) - if len(gui_command) > 0: + if len(gui_command) == 0: + print("skipping gui launch test") + else: + print(f"launching: {gui_command}") + sys.stdout.flush() try: subprocess.run( args=gui_command, From 3855698b1d1e762daf4e171e528cf2f936c73c7a Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 17 Jun 2024 15:37:55 -0400 Subject: [PATCH 4/4] Update build-macos-installers.yml --- .github/workflows/build-macos-installers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-macos-installers.yml b/.github/workflows/build-macos-installers.yml index 264a7ed48574..f8eee2a10e06 100644 --- a/.github/workflows/build-macos-installers.yml +++ b/.github/workflows/build-macos-installers.yml @@ -457,7 +457,7 @@ jobs: - name: Run chia dev installers test run: | - "/Volumes/Chia "*"/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia" dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command open --gui-command "/Volumes/Chia "*/Chia.app + "/Volumes/Chia "*"/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia" dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command "/Volumes/Chia "*/Chia.app/Contents/MacOS/Chia - name: Detach .dmg if: always()