Skip to content

Commit 76c7ed8

Browse files
authored
Merge pull request #802 from Nordix/ci-ubuntu-24.04
Replace deprecated Github runner ubuntu-20.04
2 parents 7b4f062 + 0d678c7 commit 76c7ed8

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
linux:
1212
name: Linux (${{ matrix.backend }})
13-
runs-on: ubuntu-20.04 # for OpenSSL 1.1.1
13+
runs-on: ubuntu-24.04
1414
strategy:
1515
fail-fast: false
1616
matrix:
@@ -23,6 +23,13 @@ jobs:
2323
run: |
2424
sudo apt update -qq
2525
sudo apt install libcppunit-dev libbotan-2-dev p11-kit
26+
# Replace installed OpenSSL with the supported version 1.1.1
27+
curl -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb
28+
curl -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.24_amd64.deb
29+
curl -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.1.1f-1ubuntu2.24_amd64.deb
30+
sudo dpkg -i --force-confnew openssl_1.1.1f-1ubuntu2.24_amd64.deb \
31+
libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb \
32+
libssl-dev_1.1.1f-1ubuntu2.24_amd64.deb
2633
- name: Build
2734
env:
2835
CXXFLAGS: -Werror -DBOTAN_NO_DEPRECATED_WARNINGS

src/lib/test/ForkTests.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "osmutex.h"
4141

4242
#include <sys/types.h>
43+
#include <sys/wait.h>
4344
#include <unistd.h>
4445

4546
CPPUNIT_TEST_SUITE_REGISTRATION(ForkTests);
@@ -64,6 +65,7 @@ void ForkTests::testFork()
6465
{
6566
CK_RV rv;
6667
pid_t pid;
68+
int status;
6769

6870
// Just make sure that we finalize any previous failed tests
6971
CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
@@ -78,12 +80,20 @@ void ForkTests::testFork()
7880
CPPUNIT_FAIL("Fork failed");
7981
break;
8082
case 0:
83+
/* For the child, the token is expected to still be initialized. */
8184
rv = CRYPTOKI_F_PTR( C_Initialize(NULL_PTR) );
8285
CPPUNIT_ASSERT(rv == CKR_CRYPTOKI_ALREADY_INITIALIZED);
86+
rv = CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
87+
CPPUNIT_ASSERT(rv == CKR_OK);
88+
_exit(EXIT_SUCCESS);
8389
break;
8490
default:
91+
/* For the parent, the token is expected to still be initialized. */
8592
rv = CRYPTOKI_F_PTR( C_Initialize(NULL_PTR) );
8693
CPPUNIT_ASSERT(rv == CKR_CRYPTOKI_ALREADY_INITIALIZED);
94+
/* Wait for the child process to finish and check its status. */
95+
CPPUNIT_ASSERT(waitpid(pid, &status, 0) == pid);
96+
CPPUNIT_ASSERT(WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS);
8797
break;
8898
}
8999

@@ -95,6 +105,7 @@ void ForkTests::testResetOnFork()
95105
{
96106
CK_RV rv;
97107
pid_t pid;
108+
int status;
98109

99110
// Just make sure that we finalize any previous failed tests
100111
CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
@@ -118,11 +129,17 @@ void ForkTests::testResetOnFork()
118129
/* For the child, the token is expected to be reset on fork */
119130
rv = CRYPTOKI_F_PTR( C_Initialize(NULL_PTR) );
120131
CPPUNIT_ASSERT(rv == CKR_OK);
132+
rv = CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
133+
CPPUNIT_ASSERT(rv == CKR_OK);
134+
_exit(EXIT_SUCCESS);
121135
break;
122136
default:
123137
/* For the parent, the token is expected to be still initialized */
124138
rv = CRYPTOKI_F_PTR( C_Initialize(NULL_PTR) );
125139
CPPUNIT_ASSERT(rv == CKR_CRYPTOKI_ALREADY_INITIALIZED);
140+
/* Wait for the child process to finish and check its status. */
141+
CPPUNIT_ASSERT(waitpid(pid, &status, 0) == pid);
142+
CPPUNIT_ASSERT(WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS);
126143
break;
127144
}
128145

0 commit comments

Comments
 (0)