Skip to content

Commit 6667255

Browse files
authored
Merge pull request #1885 from hj-johannes-lee/PR-2024-011
QAT, e2e: add qat-engine's testapp case
2 parents bb19a3e + bdc86bc commit 6667255

File tree

3 files changed

+88
-16
lines changed

3 files changed

+88
-16
lines changed

.github/workflows/lib-e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- accel-config-demo
2929
- intel-deviceplugin-operator
3030
- name: e2e-qat-gnrd
31-
targetjob: e2e-qat FOCUS="Mode:dpdk" SKIP="(App:(crypto-perf|compress-perf)|Functionality)"
31+
targetjob: e2e-qat FOCUS="Mode:dpdk" SKIP="(App:(crypto-perf|compress-perf|qat-engine)|Functionality)"
3232
runner: simics-gnrd
3333
images:
3434
- intel-qat-plugin

demo/openssl-qat-engine/Dockerfile

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
1-
FROM ubuntu:24.04
1+
FROM ubuntu:24.04 AS builder
2+
3+
ARG QAT_ENGINE_VERSION="v1.6.2"
24

35
RUN apt update && \
4-
apt install --no-install-recommends -y qatengine qatlib-examples qatzip openssl
6+
env DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
7+
git \
8+
ca-certificates \
9+
autoconf \
10+
automake \
11+
g++ \
12+
pkg-config \
13+
libssl-dev \
14+
libtool \
15+
libqat-dev \
16+
make \
17+
libusdm-dev
18+
19+
RUN git clone --depth 1 -b $QAT_ENGINE_VERSION https://github.com/intel/QAT_Engine
20+
21+
RUN cd /QAT_Engine && \
22+
sed -i '/fprintf(stderr, "QAT_HW device not available & QAT_SW not enabled. Using OpenSSL_SW!\\n");/ s/$/ return ret;/' e_qat.c && \
23+
./autogen.sh && \
24+
./configure \
25+
--disable-qat_sw \
26+
--with-qat_engine_id=qathwtest && \
27+
make && make test && make install
28+
29+
FROM ubuntu:24.04
30+
31+
COPY --from=builder /QAT_Engine/testapp /usr/bin/
32+
COPY --from=builder /usr/lib/x86_64-linux-gnu/engines-3/qatengine.so /usr/lib/x86_64-linux-gnu/engines-3/qathwtest.so
33+
COPY --from=builder /QAT_Engine/LICENSE /usr/share/package-licenses/QAT_Engine/LICENSE
34+
RUN apt update && env DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y qatengine qatlib-examples

test/e2e/qat/qatplugin_dpdk.go

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,16 @@ func describeQatDpdkPlugin() {
125125
})
126126

127127
ginkgo.It("deploys a crypto pod (openssl) requesting QAT resources [App:openssl]", func(ctx context.Context) {
128-
runCpaSampleCode(ctx, f, symmetric, resourceName)
128+
command := []string{
129+
"cpa_sample_code",
130+
"runTests=" + strconv.Itoa(symmetric),
131+
"signOfLife=1",
132+
}
133+
pod := createPod(ctx, f, "cpa-sample-code", resourceName, "intel/openssl-qat-engine:devel", command)
134+
135+
ginkgo.By("waiting the cpa-sample-code pod for the resource " + resourceName.String() + " to finish successfully")
136+
err := e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, pod.ObjectMeta.Name, f.Namespace.Name, 300*time.Second)
137+
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, pod.ObjectMeta.Name, pod.Spec.Containers[0].Name))
129138
})
130139

131140
ginkgo.It("deploys a crypto pod (dpdk crypto-perf) requesting QAT resources [App:crypto-perf]", func(ctx context.Context) {
@@ -137,6 +146,24 @@ func describeQatDpdkPlugin() {
137146
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, "qat-dpdk-test-crypto-perf", "crypto-perf"))
138147
})
139148

149+
ginkgo.It("deploys a crypto pod (qat-engine testapp) [App:qat-engine]", func(ctx context.Context) {
150+
command := []string{
151+
"testapp",
152+
"-engine", "qathwtest",
153+
"-async_jobs", "1",
154+
"-c", "1",
155+
"-n", "1",
156+
"-nc", "1",
157+
"-v",
158+
"-hw_algo", "0x0029",
159+
}
160+
pod := createPod(ctx, f, "qat-engine-testapp", resourceName, "intel/openssl-qat-engine:devel", command)
161+
162+
ginkgo.By("waiting the qat-engine-testapp pod for the resource " + resourceName.String() + " to finish successfully")
163+
err := e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, pod.ObjectMeta.Name, f.Namespace.Name, 300*time.Second)
164+
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, pod.ObjectMeta.Name, pod.Spec.Containers[0].Name))
165+
})
166+
140167
ginkgo.When("there is no app to run [App:noapp]", func() {
141168
ginkgo.It("does nothing", func() {})
142169
})
@@ -152,7 +179,16 @@ func describeQatDpdkPlugin() {
152179
})
153180

154181
ginkgo.It("deploys a compress pod (openssl) requesting QAT resources [App:openssl]", func(ctx context.Context) {
155-
runCpaSampleCode(ctx, f, compression, resourceName)
182+
command := []string{
183+
"cpa_sample_code",
184+
"runTests=" + strconv.Itoa(compression),
185+
"signOfLife=1",
186+
}
187+
pod := createPod(ctx, f, "cpa-sample-code", resourceName, "intel/openssl-qat-engine:devel", command)
188+
189+
ginkgo.By("waiting the cpa-sample-code pod for the resource " + resourceName.String() + " to finish successfully")
190+
err := e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, pod.ObjectMeta.Name, f.Namespace.Name, 300*time.Second)
191+
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, pod.ObjectMeta.Name, pod.Spec.Containers[0].Name))
156192
})
157193

158194
ginkgo.It("deploys a compress pod (dpdk compress-perf) requesting QAT resources [App:compress-perf]", func(ctx context.Context) {
@@ -212,23 +248,31 @@ func describeQatDpdkPlugin() {
212248
}
213249

214250
ginkgo.By("checking if openssl pod runs successfully")
215-
runCpaSampleCode(ctx, f, compression, resourceName)
251+
command := []string{
252+
"cpa_sample_code",
253+
"runTests=" + strconv.Itoa(compression),
254+
"signOfLife=1",
255+
}
256+
pod := createPod(ctx, f, "cpa-sample-code", resourceName, "intel/openssl-qat-engine:devel", command)
257+
258+
ginkgo.By("waiting the cpa-sample-code pod for the resource " + resourceName.String() + " to finish successfully")
259+
err := e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, pod.ObjectMeta.Name, f.Namespace.Name, 300*time.Second)
260+
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, pod.ObjectMeta.Name, pod.Spec.Containers[0].Name))
216261
})
217262
})
218263
})
219264
}
220265

221-
func runCpaSampleCode(ctx context.Context, f *framework.Framework, runTests int, resourceName v1.ResourceName) {
222-
ginkgo.By("submitting a pod requesting QAT" + resourceName.String() + "resources")
266+
func createPod(ctx context.Context, f *framework.Framework, name string, resourceName v1.ResourceName, image string, command []string) *v1.Pod {
223267
podSpec := &v1.Pod{
224-
ObjectMeta: metav1.ObjectMeta{Name: "openssl-qat-engine"},
268+
ObjectMeta: metav1.ObjectMeta{Name: name},
225269
Spec: v1.PodSpec{
226270
Containers: []v1.Container{
227271
{
228-
Name: "openssl-qat-engine",
229-
Image: "intel/openssl-qat-engine:devel",
272+
Name: name,
273+
Image: image,
230274
ImagePullPolicy: "IfNotPresent",
231-
Command: []string{"cpa_sample_code", "runTests=" + strconv.Itoa(runTests), "signOfLife=1"},
275+
Command: command,
232276
SecurityContext: &v1.SecurityContext{
233277
Capabilities: &v1.Capabilities{
234278
Add: []v1.Capability{"IPC_LOCK"}},
@@ -242,13 +286,11 @@ func runCpaSampleCode(ctx context.Context, f *framework.Framework, runTests int,
242286
RestartPolicy: v1.RestartPolicyNever,
243287
},
244288
}
289+
245290
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(ctx, podSpec, metav1.CreateOptions{})
246291
framework.ExpectNoError(err, "pod Create API error")
247292

248-
ginkgo.By("waiting the cpa_sample_code pod for the resource" + resourceName.String() + "to finish successfully")
249-
250-
err = e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, pod.ObjectMeta.Name, f.Namespace.Name, 300*time.Second)
251-
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, pod.ObjectMeta.Name, pod.Spec.Containers[0].Name))
293+
return pod
252294
}
253295

254296
func injectError(ctx context.Context, f *framework.Framework, resourceName v1.ResourceName) {

0 commit comments

Comments
 (0)