Skip to content

Commit 75b9aba

Browse files
committed
Run Windows installation tests
Signed-off-by: Vitalii Koshura <[email protected]>
1 parent d23edc0 commit 75b9aba

File tree

6 files changed

+108
-23
lines changed

6 files changed

+108
-23
lines changed

.github/workflows/linux-package.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ jobs:
668668
- name: Run integration tests
669669
if: success()
670670
run: |
671-
python3 ./tests/linux_package_tests/integration_tests.py
671+
python3 ./tests/linux_package_integration_tests.py
672672
673673
test-ubuntu-deb-package:
674674
name: Test Ubuntu DEB Package
@@ -752,7 +752,7 @@ jobs:
752752
- name: Run integration tests
753753
if: success()
754754
run: |
755-
python3 ./tests/linux_package_tests/integration_tests.py
755+
python3 ./tests/linux_package_integration_tests.py
756756
757757
test-fedora-rpm-package:
758758
name: Test Fedora RPM Package
@@ -825,7 +825,7 @@ jobs:
825825
- name: Run integration tests
826826
if: success()
827827
run: |
828-
python3 ./tests/linux_package_tests/integration_tests.py
828+
python3 ./tests/linux_package_integration_tests.py
829829
830830
test-opensuse-rpm-package:
831831
name: Test openSUSE RPM Package
@@ -893,7 +893,7 @@ jobs:
893893
- name: Run integration tests
894894
if: success()
895895
run: |
896-
python3 ./tests/linux_package_tests/integration_tests.py
896+
python3 ./tests/linux_package_integration_tests.py
897897
898898
publish-deb-package:
899899
name: Publish DEB Package

.github/workflows/windows.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,20 @@ jobs:
9696
if: success() && matrix.type == 'libs-cmake'
9797
run: windows\ci_build_libs_cmake.bat ${{matrix.platform}} ${{matrix.configuration}}
9898

99-
- name: Run tests
99+
- name: Run unit tests
100100
if: success() && matrix.platform == 'x64' && matrix.type == 'msbuild'
101101
working-directory: win_build\Build\${{matrix.platform}}\${{matrix.configuration}}
102102
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
103103

104+
- name: Run installation
105+
if: success() && matrix.platform == 'x64' && matrix.type == 'msbuild'
106+
shell: powershell
107+
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
108+
109+
- name: Run installation tests
110+
if: success() && matrix.platform == 'x64' && matrix.type == 'msbuild'
111+
run: python ./tests/windows_installer_integration_tests.py
112+
104113
- name: Prepare logs on failure
105114
if: ${{failure()}}
106115
run: |

tests/linux_package_tests/integration_tests.py renamed to tests/linux_package_integration_tests.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717

1818
import os
1919
import pathlib
20-
import re
2120
import sys
2221
import testset
22+
import testhelper
2323

2424
class IntegrationTests:
2525
def __init__(self):
26+
self.testhelper = testhelper.TestHelper()
2627
self.result = True
2728
self.result &= self.test_files_exist()
2829
self.result &= self.test_version()
@@ -37,23 +38,8 @@ def _get_test_executable_file_path(self, filename):
3738
return os.path.join(p, filename)
3839
return ""
3940

40-
def _get_current_version_number(self):
41-
with open("version.h", "r") as f:
42-
lines = f.readlines()
43-
for line in lines:
44-
res = re.search("#define BOINC_VERSION_STRING \"([\d]+.[\d]+.[\d]+)\"", line)
45-
if res is not None:
46-
return res[1]
47-
return ""
48-
49-
def _get_version_from_string(self, string):
50-
res = re.search("([\d]+.[\d]+.[\d]+)", string)
51-
if res is not None:
52-
return res[1]
53-
return ""
54-
5541
def _get_file_version(self, filename):
56-
return self._get_version_from_string(os.popen(("{app} --version").format(app=self._get_test_executable_file_path(filename))).read().strip())
42+
return self.testhelper.get_version_from_string(os.popen(("{app} --version").format(app=self._get_test_executable_file_path(filename))).read().strip())
5743

5844
def _get_user_exists(self, username):
5945
return os.popen("id -un {username}".format(username=username)).read().strip() == username
@@ -142,7 +128,7 @@ def test_files_exist(self):
142128

143129
def test_version(self):
144130
ts = testset.TestSet("Test version is correct")
145-
current_version = self._get_current_version_number()
131+
current_version = self.testhelper.get_current_version_number()
146132
ts.expect_not_equal("", current_version, "Test current version could be read from the 'version.h' file")
147133
ts.expect_equal(current_version, self._get_file_version("boinc"), "Test 'boinc' version is correctly set")
148134
ts.expect_equal(current_version, self._get_file_version("boinccmd"), "Test 'boinccmd' version is correctly set")

tests/testhelper.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This file is part of BOINC.
2+
# https://boinc.berkeley.edu
3+
# Copyright (C) 2024 University of California
4+
#
5+
# BOINC is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License
7+
# as published by the Free Software Foundation,
8+
# either version 3 of the License, or (at your option) any later version.
9+
#
10+
# BOINC is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+
# See the GNU Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with BOINC. If not, see <http://www.gnu.org/licenses/>.
17+
18+
import re
19+
20+
class TestHelper:
21+
def get_current_version_number(self):
22+
with open("version.h", "r") as f:
23+
lines = f.readlines()
24+
for line in lines:
25+
res = re.search("#define BOINC_VERSION_STRING \"([\d]+.[\d]+.[\d]+)\"", line)
26+
if res is not None:
27+
return res[1]
28+
return ""
29+
30+
def get_version_from_string(self, string):
31+
res = re.search("([\d]+.[\d]+.[\d]+)", string)
32+
if res is not None:
33+
return res[1]
34+
return ""
File renamed without changes.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This file is part of BOINC.
2+
# https://boinc.berkeley.edu
3+
# Copyright (C) 2024 University of California
4+
#
5+
# BOINC is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License
7+
# as published by the Free Software Foundation,
8+
# either version 3 of the License, or (at your option) any later version.
9+
#
10+
# BOINC is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+
# See the GNU Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with BOINC. If not, see <http://www.gnu.org/licenses/>.
17+
18+
import os
19+
import testset as testset
20+
import testhelper as testhelper
21+
22+
class IntegrationTests:
23+
def __init__(self):
24+
self.testhelper = testhelper.TestHelper()
25+
self.result = True
26+
self.result &= test_version()
27+
self.result &= test_files_exist()
28+
29+
def _get_test_executable_file_path(self, filename):
30+
return os.path.join("C:\\Program\ Files\\BOINC", filename)
31+
32+
def _get_file_version(self, filename):
33+
return self.testhelper.get_version_from_string(os.popen(("{app} --version").format(app=self._get_test_executable_file_path(filename))).read().strip())
34+
35+
def test_version(self):
36+
ts = testset.TestSet("Test version is correct")
37+
current_version = self.testhelper.get_current_version_number()
38+
ts.expect_not_equal("", current_version, "Test current version could be read from the 'version.h' file")
39+
ts.expect_equal(current_version, self._get_file_version("boinc.exe"), "Test 'boinc.exe' version is correctly set")
40+
ts.expect_equal(current_version, self._get_file_version("boinccmd.exe"), "Test 'boinccmd.exe' version is correctly set")
41+
return ts.result()
42+
43+
def test_files_exist(self):
44+
ts = testset.TestSet("Test files exist")
45+
ts.expect_equal("C:\\Program\ Files\\BOINC\\boinc.exe", self._get_test_executable_file_path("boinc.exe"), "Test 'boinc.exe' file location")
46+
ts.expect_equal("C:\\Program\ Files\\BOINC\\boinccmd.exe", self._get_test_executable_file_path("boinccmd.exe"), "Test 'boinccmd.exe' file location")
47+
ts.expect_equal("C:\\Program\ Files\\BOINC\\boincmgr.exe", self._get_test_executable_file_path("boincmgr.exe"), "Test 'boincmgr.exe' file location")
48+
ts.expect_equal("C:\\Program\ Files\\BOINC\\boincscr.exe", self._get_test_executable_file_path("boincscr.exe"), "Test 'boincscr.exe' file location")
49+
ts.expect_equal("C:\\Program\ Files\\BOINC\\boincsvcctrl.exe", self._get_test_executable_file_path("boincsvcctrl.exe"), "Test 'boincsvcctrl.exe' file location")
50+
ts.expect_equal("C:\\Program\ Files\\BOINC\\boinctray.exe", self._get_test_executable_file_path("boinctray.exe"), "Test 'boinctray.exe' file location")
51+
ts.expect_true(os.path.exists("C:\\ProgramData\\BOINC\\all_projects_list.xml"), "Test 'all_projects_list.xml' file exists in 'C:\\ProgramData\\BOINC\\'")
52+
53+
if __name__ == "__main__":
54+
if not IntegrationTests().result:
55+
sys.exit(1)
56+
sys.exit(0)

0 commit comments

Comments
 (0)