diff --git a/.github/workflows/linux-package.yml b/.github/workflows/linux-package.yml index 96d5ee774ca..aad705cfa71 100644 --- a/.github/workflows/linux-package.yml +++ b/.github/workflows/linux-package.yml @@ -668,7 +668,7 @@ jobs: - name: Run integration tests if: success() run: | - python3 ./tests/linux_package_tests/integration_tests.py + python3 ./tests/linux_package_integration_tests.py test-ubuntu-deb-package: name: Test Ubuntu DEB Package @@ -752,7 +752,7 @@ jobs: - name: Run integration tests if: success() run: | - python3 ./tests/linux_package_tests/integration_tests.py + python3 ./tests/linux_package_integration_tests.py test-fedora-rpm-package: name: Test Fedora RPM Package @@ -825,7 +825,7 @@ jobs: - name: Run integration tests if: success() run: | - python3 ./tests/linux_package_tests/integration_tests.py + python3 ./tests/linux_package_integration_tests.py test-opensuse-rpm-package: name: Test openSUSE RPM Package @@ -893,7 +893,7 @@ jobs: - name: Run integration tests if: success() run: | - python3 ./tests/linux_package_tests/integration_tests.py + python3 ./tests/linux_package_integration_tests.py publish-deb-package: name: Publish DEB Package diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index fce0682e4b5..402b7988a86 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -101,6 +101,12 @@ jobs: working-directory: win_build\Build\${{matrix.platform}}\${{matrix.configuration}} run: ${{github.workspace}}\temp\OpenCppCoverage\OpenCppCoverage-x64\OpenCppCoverage.exe --cover_children --optimized_build --sources ${{github.workspace}} --export_type=cobertura:cobertura.xml -- unittests.exe --gtest_output=xml:gtest.xml + - name: Run installation + if: success() && matrix.platform == 'x64' && matrix.type == 'msbuild' + shell: powershell + run: | + Start-Process "msiexec.exe" -ArgumentList "/i ${{github.workspace}}\win_build\Build\x64\${{matrix.configuration}}\boinc.msi /quiet /qn /l*v ${{github.workspace}}\win_build\Build\x64\${{matrix.configuration}}\install.log" -Wait + - name: Prepare logs on failure if: ${{failure()}} run: | diff --git a/tests/linux_package_tests/integration_tests.py b/tests/linux_package_integration_tests.py similarity index 95% rename from tests/linux_package_tests/integration_tests.py rename to tests/linux_package_integration_tests.py index 297501278d4..6cc8aed8890 100644 --- a/tests/linux_package_tests/integration_tests.py +++ b/tests/linux_package_integration_tests.py @@ -17,9 +17,9 @@ import os import pathlib -import re import sys import testset +import testhelper class IntegrationTests: def __init__(self): @@ -37,23 +37,8 @@ def _get_test_executable_file_path(self, filename): return os.path.join(p, filename) return "" - def _get_current_version_number(self): - with open("version.h", "r") as f: - lines = f.readlines() - for line in lines: - res = re.search("#define BOINC_VERSION_STRING \"([\d]+.[\d]+.[\d]+)\"", line) - if res is not None: - return res[1] - return "" - - def _get_version_from_string(self, string): - res = re.search("([\d]+.[\d]+.[\d]+)", string) - if res is not None: - return res[1] - return "" - def _get_file_version(self, filename): - return self._get_version_from_string(os.popen(("{app} --version").format(app=self._get_test_executable_file_path(filename))).read().strip()) + return testhelper.get_version_from_string(os.popen(("{app} --version").format(app=self._get_test_executable_file_path(filename))).read().strip()) def _get_user_exists(self, username): return os.popen("id -un {username}".format(username=username)).read().strip() == username @@ -142,7 +127,7 @@ def test_files_exist(self): def test_version(self): ts = testset.TestSet("Test version is correct") - current_version = self._get_current_version_number() + current_version = testhelper.get_current_version_number() ts.expect_not_equal("", current_version, "Test current version could be read from the 'version.h' file") ts.expect_equal(current_version, self._get_file_version("boinc"), "Test 'boinc' version is correctly set") ts.expect_equal(current_version, self._get_file_version("boinccmd"), "Test 'boinccmd' version is correctly set") diff --git a/tests/testhelper.py b/tests/testhelper.py new file mode 100644 index 00000000000..b235850b5a6 --- /dev/null +++ b/tests/testhelper.py @@ -0,0 +1,34 @@ +# This file is part of BOINC. +# https://boinc.berkeley.edu +# Copyright (C) 2024 University of California +# +# BOINC is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. +# +# BOINC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with BOINC. If not, see . + +import re + +class TestHelper: + def get_current_version_number(self): + with open("version.h", "r") as f: + lines = f.readlines() + for line in lines: + res = re.search("#define BOINC_VERSION_STRING \"([\d]+.[\d]+.[\d]+)\"", line) + if res is not None: + return res[1] + return "" + + def get_version_from_string(self, string): + res = re.search("([\d]+.[\d]+.[\d]+)", string) + if res is not None: + return res[1] + return "" diff --git a/tests/linux_package_tests/testset.py b/tests/testset.py similarity index 100% rename from tests/linux_package_tests/testset.py rename to tests/testset.py diff --git a/tests/windows_installer_integration_tests.py b/tests/windows_installer_integration_tests.py new file mode 100644 index 00000000000..1bbb964d283 --- /dev/null +++ b/tests/windows_installer_integration_tests.py @@ -0,0 +1,46 @@ +# This file is part of BOINC. +# https://boinc.berkeley.edu +# Copyright (C) 2024 University of California +# +# BOINC is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. +# +# BOINC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with BOINC. If not, see . + +import os +import testset as testset +import testhelper as testhelper + +class IntegrationTests: + def __init__(self): + self.result = True + self.result &= test_version() + self.result &= test_files_exist() + + def _get_test_executable_file_path(self, filename): + return os.path.join("C:\\Program\ Files\\BOINC", filename) + + def _get_file_version(self, filename): + return testhelper.get_version_from_string(os.popen(("{app} --version").format(app=self._get_test_executable_file_path(filename))).read().strip()) + + def test_version(self): + ts = testset.TestSet("Test version is correct") + current_version = testhelper.get_current_version_number() + ts.expect_not_equal("", current_version, "Test current version could be read from the 'version.h' file") + ts.expect_equal(current_version, self._get_file_version("boinc.exe"), "Test 'boinc.exe' version is correctly set") + ts.expect_equal(current_version, self._get_file_version("boinccmd.exe"), "Test 'boinccmd.exe' version is correctly set") + return ts.result() + + def test_files_exist(self): + ts = testset.TestSet("Test files exist") + ts.expect_equal("C:\\Program\ Files\\BOINC\\boinc.exe", self._get_test_executable_file_path("boinc.exe"), "Test 'boinc.exe' file location") + ts.expect_equal("C:\\Program\ Files\\BOINC\\boinccmd.exe", self._get_test_executable_file_path("boinccmd.exe"), "Test 'boinccmd.exe' file location") + ts.expect_equal("C:\\Program\ Files\\BOINC\\boincmgr.exe", self._get_test_executable_file_path("boincmgr.exe"), "Test 'boincmgr.exe' file location")