Skip to content

Commit ba3dfe3

Browse files
committed
Attempt to have unit and integration tests work with ARM64
1 parent 73b96fa commit ba3dfe3

File tree

6 files changed

+177
-36
lines changed

6 files changed

+177
-36
lines changed

.github/workflows/webserver.yml

Lines changed: 163 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,18 @@ on:
1313
- '.github/workflows/webserver.yml'
1414

1515
jobs:
16-
webserver-build-test-ubuntu:
17-
name: webserver-ubuntu-build
16+
webserver-build-test-ubuntu-x64:
17+
name: webserver-ubuntu-build-x64
1818
runs-on: ubuntu-20.04
1919
steps:
2020
- name: checkout otel webserver
2121
uses: actions/checkout@v3
22-
- name: setup qemu
23-
uses: docker/setup-qemu-action@master
2422
- name: setup buildx
2523
id: buildx
2624
uses: docker/setup-buildx-action@master
2725
with:
2826
install: true
29-
platforms: linux/amd64,linux/arm64
27+
platforms: linux/amd64
3028
- name: cache docker layers
3129
uses: actions/cache@v3
3230
with:
@@ -37,18 +35,18 @@ jobs:
3735
- name: setup docker image
3836
run: |
3937
cd instrumentation/otel-webserver-module
40-
docker buildx build -t apache_ubuntu -f docker/ubuntu20.04/Dockerfile \
41-
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu \
42-
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu-new \
38+
docker buildx build -t apache_ubuntu_amd64 -f docker/ubuntu20.04/Dockerfile \
39+
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_amd64 \
40+
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_amd64-new \
4341
--load .
4442
- name: build
4543
run: |
46-
docker run -idt --name apache_ubuntu_container apache_ubuntu /bin/bash
44+
docker run -idt --name apache_ubuntu_container_amd64 apache_ubuntu_amd64 /bin/bash
4745
cd instrumentation/otel-webserver-module
48-
docker exec apache_ubuntu_container bash -c \
46+
docker exec apache_ubuntu_container_amd64 bash -c \
4947
'cd /otel-webserver-module; rm -rf *;'
50-
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container):/otel-webserver-module/
51-
docker exec apache_ubuntu_container bash -c \
48+
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container_amd64):/otel-webserver-module/
49+
docker exec apache_ubuntu_container_amd64 bash -c \
5250
'cd /otel-webserver-module; rm -rf build; \
5351
cp -r /dependencies /otel-webserver-module/; \
5452
cp -r /build-dependencies /otel-webserver-module/; \
@@ -57,11 +55,11 @@ jobs:
5755
5856
- name: update cache
5957
run: |
60-
rm -rf /tmp/buildx-cache/apache_ubuntu
61-
mv /tmp/buildx-cache/apache_ubuntu-new /tmp/buildx-cache/apache_ubuntu
58+
rm -rf /tmp/buildx-cache/apache_ubuntu_amd64
59+
mv /tmp/buildx-cache/apache_ubuntu_amd64-new /tmp/buildx-cache/apache_ubuntu_amd64
6260
63-
webserver-build-test-centos7:
64-
name: webserver-centos7-build
61+
webserver-build-test-ubuntu-arm64:
62+
name: webserver-ubuntu-build-arm64
6563
runs-on: ubuntu-20.04
6664
steps:
6765
- name: checkout otel webserver
@@ -73,7 +71,75 @@ jobs:
7371
uses: docker/setup-buildx-action@master
7472
with:
7573
install: true
76-
platforms: linux/amd64,linux/arm64
74+
platforms: linux/arm64
75+
- name: cache docker layers
76+
uses: actions/cache@v3
77+
with:
78+
path: /tmp/buildx-cache/
79+
key: apache-ubuntu-20.04-${{ github.sha }}
80+
restore-keys: |
81+
apache-ubuntu-20.04
82+
- name: setup docker image
83+
run: |
84+
cd instrumentation/otel-webserver-module
85+
docker buildx build -t apache_ubuntu_arm64 -f docker/ubuntu20.04/Dockerfile \
86+
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_arm64 \
87+
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_arm64-new \
88+
--load . --platform linux/arm64
89+
- name: build
90+
run: |
91+
docker run -idt --platform linux/arm64 --name apache_ubuntu_container_arm64 apache_ubuntu_arm64 /bin/bash
92+
cd instrumentation/otel-webserver-module
93+
docker exec apache_ubuntu_container_arm64 bash -c \
94+
'cd /otel-webserver-module; rm -rf *;'
95+
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container_arm64):/otel-webserver-module/
96+
docker exec apache_ubuntu_container_arm64 bash -c \
97+
'cd /otel-webserver-module; rm -rf build; \
98+
cp -r /dependencies /otel-webserver-module/; \
99+
cp -r /build-dependencies /otel-webserver-module/; \
100+
101+
./gradlew assembleWebServerModule -DtargetSystem=ubuntu'
102+
- name: unit test
103+
run: |
104+
docker exec apache_ubuntu_container_arm64 bash -c \
105+
'cd /otel-webserver-module; ./gradlew runUnitTest'
106+
- name: update cache
107+
run: |
108+
rm -rf /tmp/buildx-cache/apache_ubuntu_arm64
109+
mv /tmp/buildx-cache/apache_ubuntu_arm64-new /tmp/buildx-cache/apache_ubuntu_arm64
110+
- name: copy artifacts
111+
id: artifacts
112+
run: |
113+
cd instrumentation/otel-webserver-module
114+
mkdir -p /tmp/apache_ubuntu_arm64/
115+
docker cp apache_ubuntu_container_arm64:/otel-webserver-module/build/opentelemetry-webserver-sdk-arm64-linux.tgz \
116+
/tmp/apache_ubuntu_arm64/
117+
- name: upload artifacts
118+
uses: actions/upload-artifact@v3
119+
with:
120+
name: opentelemetry-webserver-sdk-arm64-linux.tgz
121+
path: /tmp/apache_ubuntu_arm64/opentelemetry-webserver-sdk-arm64-linux.tgz
122+
- name: run integrationtest
123+
run: |
124+
docker rm -f apache_ubuntu_container_arm64
125+
cd instrumentation/otel-webserver-module
126+
docker compose --profile ubuntu20.04 up -d
127+
docker ps -a
128+
sleep 30
129+
./gradlew :test:integration:integrationTests -i
130+
131+
webserver-build-test-centos7-x64:
132+
name: webserver-centos7-build-x64
133+
runs-on: ubuntu-20.04
134+
steps:
135+
- name: checkout otel webserver
136+
uses: actions/checkout@v3
137+
- name: setup buildx
138+
id: buildx
139+
uses: docker/setup-buildx-action@master
140+
with:
141+
install: true
142+
platforms: linux/amd64
77143
# - name: cache docker layers
78144
# uses: actions/cache@v3
79145
# with:
@@ -84,49 +150,116 @@ jobs:
84150
- name: setup docker image
85151
run: |
86152
cd instrumentation/otel-webserver-module
87-
docker buildx build -t apache_centos7 -f docker/centos7/Dockerfile \
153+
docker buildx build -t apache_centos7_amd64 -f docker/centos7/Dockerfile \
88154
--load .
89155
- name: build
90156
run: |
91-
docker run -idt --name apache_centos7_container apache_centos7 /bin/bash
157+
docker run -idt --name apache_centos7_container_amd64 apache_centos7_amd64 /bin/bash
92158
cd instrumentation/otel-webserver-module
93-
docker exec apache_centos7_container bash -c \
159+
docker exec apache_centos7_container_amd64 bash -c \
94160
'cd /otel-webserver-module; rm -rf *;'
95-
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container):/otel-webserver-module/
96-
docker exec apache_centos7_container bash -c \
161+
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container_amd64):/otel-webserver-module/
162+
docker exec apache_centos7_container_amd64 bash -c \
97163
'cd /otel-webserver-module; rm -rf build; \
98164
cp -r /dependencies /otel-webserver-module/; \
99165
cp -r /build-dependencies /otel-webserver-module/; \
100166
./gradlew assembleWebServerModule'
101167
- name: unit test
102168
run: |
103-
docker exec apache_centos7_container bash -c \
169+
docker exec apache_centos7_container_amd64 bash -c \
104170
'cd /otel-webserver-module; ./gradlew runUnitTest'
105171
# - name: update cache
106172
# run: |
107-
# rm -rf /tmp/buildx-cache/apache_centos7
108-
# mv /tmp/buildx-cache/apache_centos7-new /tmp/buildx-cache/apache_centos7
173+
# rm -rf /tmp/buildx-cache/apache_centos7_amd64
174+
# mv /tmp/buildx-cache/apache_centos7_amd64-new /tmp/buildx-cache/apache_centos7_amd64
109175
- name: copy artifacts
110176
id: artifacts
111177
run: |
112178
cd instrumentation/otel-webserver-module
113-
mkdir -p /tmp/apache_centos7/
114-
docker cp apache_centos7_container:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \
115-
/tmp/apache_centos7/
179+
mkdir -p /tmp/apache_centos7_amd64/
180+
docker cp apache_centos7_container_amd64:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \
181+
/tmp/apache_centos7_amd64/
116182
- name: upload artifacts
117183
uses: actions/upload-artifact@v3
118184
with:
119185
name: opentelemetry-webserver-sdk-x64-linux.tgz
120-
path: /tmp/apache_centos7/opentelemetry-webserver-sdk-x64-linux.tgz
186+
path: /tmp/apache_centos7_amd64/opentelemetry-webserver-sdk-x64-linux.tgz
121187
- name: run integrationtest
122188
run: |
123-
docker rm -f apache_centos7_container
189+
docker rm -f apache_centos7_container_amd64
124190
cd instrumentation/otel-webserver-module
125191
docker compose --profile centos7 up -d
126192
docker ps -a
127193
sleep 30
128194
./gradlew :test:integration:integrationTests -i
129195
196+
# webserver-build-test-centos7-arm64:
197+
# name: webserver-centos7-build-arm64
198+
# runs-on: ubuntu-20.04
199+
# steps:
200+
# - name: checkout otel webserver
201+
# uses: actions/checkout@v3
202+
# - name: setup qemu
203+
# uses: docker/setup-qemu-action@master
204+
# - name: setup buildx
205+
# id: buildx
206+
# uses: docker/setup-buildx-action@master
207+
# with:
208+
# install: true
209+
# platforms: linux/arm64
210+
# # - name: cache docker layers
211+
# # uses: actions/cache@v3
212+
# # with:
213+
# # path: /tmp/buildx-cache/
214+
# # key: apache-centos7-${{ github.sha }}
215+
# # restore-keys: |
216+
# # apache-centos7
217+
# - name: setup docker image
218+
# run: |
219+
# cd instrumentation/otel-webserver-module
220+
# docker buildx build -t apache_centos7_arm64 -f docker/centos7/Dockerfile \
221+
# --load . --platform linux/arm64
222+
# - name: build
223+
# run: |
224+
# docker run -idt --platform linux/arm64 --name apache_centos7_container_arm64 apache_centos7_arm64 /bin/bash
225+
# cd instrumentation/otel-webserver-module
226+
# docker exec apache_centos7_container_arm64 bash -c \
227+
# 'cd /otel-webserver-module; rm -rf *;'
228+
# docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container_arm64):/otel-webserver-module/
229+
# docker exec apache_centos7_container_arm64 bash -c \
230+
# 'cd /otel-webserver-module; rm -rf build; \
231+
# cp -r /dependencies /otel-webserver-module/; \
232+
# cp -r /build-dependencies /otel-webserver-module/; \
233+
# ./gradlew assembleWebServerModule'
234+
# - name: unit test
235+
# run: |
236+
# docker exec apache_centos7_container_arm64 bash -c \
237+
# 'cd /otel-webserver-module; ./gradlew runUnitTest'
238+
# # - name: update cache
239+
# # run: |
240+
# # rm -rf /tmp/buildx-cache/apache_centos7_arm64
241+
# # mv /tmp/buildx-cache/apache_centos7_arm64-new /tmp/buildx-cache/apache_centos7_arm64
242+
# - name: copy artifacts
243+
# id: artifacts
244+
# run: |
245+
# cd instrumentation/otel-webserver-module
246+
# mkdir -p /tmp/apache_centos7_arm64/
247+
# docker cp apache_centos7_container_arm64:/otel-webserver-module/build/opentelemetry-webserver-sdk-arm64-linux.tgz \
248+
# /tmp/apache_centos7_arm64/
249+
# - name: upload artifacts
250+
# uses: actions/upload-artifact@v3
251+
# with:
252+
# name: opentelemetry-webserver-sdk-arm64-linux.tgz
253+
# path: /tmp/apache_centos7_arm64/opentelemetry-webserver-sdk-arm64-linux.tgz
254+
# - name: run integrationtest
255+
# run: |
256+
# docker rm -f apache_centos7_container_arm64
257+
# cd instrumentation/otel-webserver-module
258+
# docker compose --profile centos7 up -d
259+
# docker ps -a
260+
# sleep 30
261+
# ./gradlew :test:integration:integrationTests -i
262+
130263
# webserver-build-test-centos6:
131264
# name: webserver-centos6-build
132265
# runs-on: ubuntu-20.04

instrumentation/otel-webserver-module/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ project.ext {
2323

2424
ansdkOsName = osName
2525
ansdkArch = (osArch == 'x86' ? 'i686' : osArch)
26-
gccArchFlag = (osArch == 'x86' ? '-m32' : (osArch == 'aarch64' ? '-march=armv8-a' : '-m64'))
26+
gccArchFlag = (osArch == 'x86' ? '-m32' : (osArch == 'arm64' ? '-march=armv8-a' : '-m64'))
2727
headSHA1 = "<dev>"
2828

2929
try {
@@ -499,7 +499,7 @@ task gypUnitTest(type: Exec) {
499499
ANSDK_DIR: modDepDir,
500500
BOOST_LIB: BOOST_LIB,
501501
BOOST_INCLUDE: BOOST_INCLUDE,
502-
GTEST_LIB_DIR: target_system == "ubuntu" ?
502+
GTEST_LIB_DIR: target_system == "ubuntu" || osArch == "arm64" ?
503503
"${modDepDir}/googletest/1.10.0/lib" : "${modDepDir}/googletest/1.10.0/lib64",
504504
LIBRARY_FLAGS: libraryFlags,
505505
CPP_SDK_VERSION: cppSDKVersion,
@@ -536,7 +536,7 @@ task runApacheServer(type: Exec) {
536536
dependsOn assembleApacheModule
537537

538538
workingDir 'test'
539-
commandLine './ApacheTesting.sh', "${target_system}"
539+
commandLine './ApacheTesting.sh', "${target_system}", "${osArch}"
540540
}
541541

542542
// Code Coverage

instrumentation/otel-webserver-module/common.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ defaultTasks 'build'
88
ext {
99
ARCH = ''
1010
switch (System.properties['os.arch'].toLowerCase()) {
11+
case "aarch64":
12+
ARCH = "arm64"
13+
break
1114
case "amd64":
1215
case "x86_64":
1316
ARCH = "x64"
@@ -42,6 +45,8 @@ ext {
4245
osArch = 'x86'
4346
} else if (osArch == 'x86_64' || osArch == 'amd64') {
4447
osArch = 'x64'
48+
} else if (osArch == 'aarch64') {
49+
osArch = 'arm64'
4550
}
4651

4752
BUILD_SHA1 = System.getenv('BUILD_SHA')

instrumentation/otel-webserver-module/test/ApacheTesting.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
# Extract the agent
66

77
targetSystem=$1
8+
platform=$2
89

910
OTelApacheModule="/opt/opentelemetry-webserver-sdk/WebServerModule/Apache/libmod_apache_otel22.so"
1011
if [ $targetSystem = "ubuntu" ] || [ $targetSystem = "centos7" ]; then
1112
OTelApacheModule="/opt/opentelemetry-webserver-sdk/WebServerModule/Apache/libmod_apache_otel.so"
1213
fi
1314

1415

15-
tar -xf ../build/opentelemetry-webserver-sdk-x64-linux.tgz -C /opt
16+
tar -xf ../build/opentelemetry-webserver-sdk-$platform-linux.tgz -C /opt
1617

1718
cd /opt/opentelemetry-webserver-sdk
1819

instrumentation/otel-webserver-module/test/NginxTesting.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# Bash script for testing Apache Server
44

55
# Extract the agent
6-
tar -xf ../build/opentelemetry-webserver-sdk-x64-linux.tgz -C /opt
6+
platform=$1
7+
8+
tar -xf ../build/opentelemetry-webserver-sdk-$platform-linux.tgz -C /opt
79

810
cd /opt/opentelemetry-sdk-native
911

instrumentation/otel-webserver-module/test/unit/ApiUtils_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,5 +421,5 @@ TEST(ApiUtils, getSDKInstallPath)
421421
{
422422
otel::core::ApiUtils apiUtils;
423423
auto path = apiUtils.getSDKInstallPath();
424-
EXPECT_THAT(path.string(), testing::EndsWith("build/linux-x64/opentelemetry-webserver-sdk"));
424+
EXPECT_THAT(path.string(), testing::MatchesRegex(".*build/linux-(x|arm)64/opentelemetry-webserver-sdk"));
425425
}

0 commit comments

Comments
 (0)