1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
|
From c0d86490ba53bf9a33f7569dc31c4ec1ba54f073 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Tue, 21 Nov 2023 21:32:08 +0800
Subject: [PATCH 31/64] modify CI for default runtime to runc
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
CI/test_cases/container_cases/cni_test.sh | 103 ++++++++++--------
.../container_cases/exec_additional_gids.sh | 26 +++--
CI/test_cases/container_cases/export.sh | 10 +-
.../hook_ignore_poststart_error.sh | 10 +-
.../container_cases/hook_spec_test.sh | 12 +-
...igdata_stream.sh => lcr_bigdata_stream.sh} | 32 +-----
.../container_cases/{exec.sh => lcr_exec.sh} | 2 +-
CI/test_cases/container_cases/nano_cpus.sh | 8 +-
CI/test_cases/container_cases/restart.sh | 14 ++-
CI/test_cases/container_cases/run.sh | 49 +++++----
..._stream_runc.sh => runc_bigdata_stream.sh} | 0
.../{exec_runc.sh => runc_exec.sh} | 0
CI/test_cases/container_cases/seccomp.sh | 12 +-
CI/test_cases/container_cases/stop.sh | 19 +++-
CI/test_cases/critest.sh | 6 +-
15 files changed, 166 insertions(+), 137 deletions(-)
rename CI/test_cases/container_cases/{bigdata_stream.sh => lcr_bigdata_stream.sh} (93%)
rename CI/test_cases/container_cases/{exec.sh => lcr_exec.sh} (97%)
rename CI/test_cases/container_cases/{bigdata_stream_runc.sh => runc_bigdata_stream.sh} (100%)
rename CI/test_cases/container_cases/{exec_runc.sh => runc_exec.sh} (100%)
diff --git a/CI/test_cases/container_cases/cni_test.sh b/CI/test_cases/container_cases/cni_test.sh
index bbc381dd..114cf2a3 100755
--- a/CI/test_cases/container_cases/cni_test.sh
+++ b/CI/test_cases/container_cases/cni_test.sh
@@ -37,6 +37,10 @@ function do_post()
start_isulad_with_valgrind
}
+# $1: pod runtime;
+# $2: pod config;
+# $3: eth0 ip;
+# $4: eth1 ip;
function do_test_help()
{
msg_info "this is $0 do_test"
@@ -53,7 +57,7 @@ function do_test_help()
TC_RET_T=$(($TC_RET_T+1))
fi
- sid=`crictl runp ${data_path}/$1`
+ sid=`crictl runp --runtime $1 ${data_path}/$2`
if [ $? -ne 0 ]; then
msg_err "Failed to run sandbox"
TC_RET_T=$(($TC_RET_T+1))
@@ -61,7 +65,7 @@ function do_test_help()
cnt=`ls /var/lib/cni/results/* | wc -l`
target_cnt=1
- if [ "x$3" != "x" ];then
+ if [ "x$4" != "x" ];then
target_cnt=2
fi
@@ -77,7 +81,7 @@ function do_test_help()
TC_RET_T=$(($TC_RET_T+1))
fi
- cid=`crictl create $sid ${data_path}/container-config.json ${data_path}/$1`
+ cid=`crictl create $sid ${data_path}/container-config.json ${data_path}/$2`
if [ $? -ne 0 ];then
msg_err "create container failed"
TC_RET_T=$(($TC_RET_T+1))
@@ -107,29 +111,29 @@ function do_test_help()
nsenter -t $con_pid -n ifconfig eth0
TC_RET_T=$(($TC_RET_T+1))
fi
- nsenter -t $pod_pid -n ifconfig eth0 | grep "$2"
+ nsenter -t $pod_pid -n ifconfig eth0 | grep "$3"
if [ $? -ne 0 ];then
- msg_err "expect ip: $1, get: "
+ msg_err "expect ip: $3, get: "
nsenter -t $pod_pid -n ifconfig eth0
TC_RET_T=$(($TC_RET_T+1))
fi
- crictl inspectp $sid | grep "$2"
+ crictl inspectp $sid | grep "$3"
if [ $? -ne 0 ];then
- msg_err "inspectp: expect ip: $1, get: "
+ msg_err "inspectp: expect ip: $3, get: "
crictl inspectp $sid
TC_RET_T=$(($TC_RET_T+1))
fi
- if [ "x$3" != "x" ];then
- nsenter -t $pod_pid -n ifconfig eth1 | grep "$3"
+ if [ "x$4" != "x" ];then
+ nsenter -t $pod_pid -n ifconfig eth1 | grep "$4"
if [ $? -ne 0 ];then
- msg_err "expect ip: $2, get: "
+ msg_err "expect ip: $4, get: "
nsenter -t $pod_pid -n ifconfig eth1
TC_RET_T=$(($TC_RET_T+1))
fi
- crictl inspectp $sid | grep "$3"
+ crictl inspectp $sid | grep "$4"
if [ $? -ne 0 ];then
- msg_err "inspectp expect ip: $2, get: "
+ msg_err "inspectp expect ip: $4, get: "
crictl inspectp $sid
TC_RET_T=$(($TC_RET_T+1))
fi
@@ -170,7 +174,7 @@ function do_test_help()
function default_cni_config()
{
- do_test_help "sandbox-config.json" "10\.1\."
+ do_test_help $1 "sandbox-config.json" "10\.1\."
}
function new_cni_config()
@@ -189,12 +193,12 @@ function new_cni_config()
fi
done
tail $ISUALD_LOG
- do_test_help "mutlnet_pod.json" "10\.2\." "10\.1\."
+ do_test_help $1 "mutlnet_pod.json" "10\.2\." "10\.1\."
}
function check_annotation_extension()
{
- sid=`crictl runp ${data_path}/sandbox-config.json`
+ sid=`crictl runp --runtime $1 ${data_path}/sandbox-config.json`
if [ $? -ne 0 ]; then
msg_err "Failed to run sandbox"
TC_RET_T=$(($TC_RET_T+1))
@@ -253,7 +257,7 @@ function check_rollback()
done
tail $ISUALD_LOG
- crictl runp ${data_path}/mutl_wrong_net_pod.json
+ crictl runp --runtime $1 ${data_path}/mutl_wrong_net_pod.json
if [ $? -eq 0 ]; then
msg_err "Run sandbox success with invalid cni configs"
TC_RET_T=$(($TC_RET_T+1))
@@ -302,13 +306,14 @@ function check_rollback()
# $2: expect ingress rate;
# $3: input egress rate;
# $4: expect egress rate;
+# $5: pod runtime;
function check_annotation_valid_bandwidth()
{
rm bandwidth.json
cp ${data_path}/mock_sandbox.json bandwidth.json
sed -i "s#ingressholder#$1#g" bandwidth.json
sed -i "s#engressholder#$3#g" bandwidth.json
- sid=`crictl runp bandwidth.json`
+ sid=`crictl runp --runtime $5 bandwidth.json`
if [ $? -ne 0 ]; then
msg_err "Failed to run sandbox"
TC_RET_T=$(($TC_RET_T+1))
@@ -345,6 +350,7 @@ function check_annotation_valid_bandwidth()
return $TC_RET_T
}
+# function not called
function check_annotation_invalid_bandwidth()
{
rm bandwidth.json
@@ -386,44 +392,51 @@ function check_annotation()
done
tail $ISUALD_LOG
- check_annotation_extension
+ check_annotation_extension $1
- check_annotation_valid_bandwidth "10.24k" "10240" "-1.024k" "-1024"
- check_annotation_valid_bandwidth "1024m" "2" "-1024m" "-1"
- check_annotation_valid_bandwidth "1.000001Ki" "1025" "-1.00001Ki" "-1024"
- check_annotation_valid_bandwidth "0.1Mi" "104858" "-0.01Mi" "-10485"
- check_annotation_valid_bandwidth "1.00001e2" "101" "-1.0001e2" "-100"
+ check_annotation_valid_bandwidth "10.24k" "10240" "-1.024k" "-1024" $1
+ check_annotation_valid_bandwidth "1024m" "2" "-1024m" "-1" $1
+ check_annotation_valid_bandwidth "1.000001Ki" "1025" "-1.00001Ki" "-1024" $1
+ check_annotation_valid_bandwidth "0.1Mi" "104858" "-0.01Mi" "-10485" $1
+ check_annotation_valid_bandwidth "1.00001e2" "101" "-1.0001e2" "-100" $1
return $TC_RET_T
}
-ret=0
+function do_test_t()
+{
+ local ret=0
+ local runtime=$1
+ local test="cni_test => (${runtime})"
+ msg_info "${test} starting..."
+
+ default_cni_config $runtime || ((ret++))
+
+ new_cni_config $runtime || ((ret++))
+
+ check_annotation $runtime || ((ret++))
-do_pre
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+ check_rollback $runtime || ((ret++))
-default_cni_config
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+ msg_info "${test} finished with return ${ret}..."
-new_cni_config
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+ return $ret
+}
-check_annotation
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+ret=0
-check_rollback
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+for element in ${RUNTIME_LIST[@]};
+do
+ do_pre
+ if [ $? -ne 0 ];then
+ let "ret=$ret + 1"
+ fi
-do_post
+ do_test_t $element
+ if [ $? -ne 0 ];then
+ let "ret=$ret + 1"
+ fi
+ do_post
+done
show_result $ret "cni base test"
diff --git a/CI/test_cases/container_cases/exec_additional_gids.sh b/CI/test_cases/container_cases/exec_additional_gids.sh
index f24678d3..2edfd750 100755
--- a/CI/test_cases/container_cases/exec_additional_gids.sh
+++ b/CI/test_cases/container_cases/exec_additional_gids.sh
@@ -22,7 +22,6 @@
curr_path=$(dirname $(readlink -f "$0"))
data_path=$(realpath $curr_path/../data)
source ../helpers.sh
-test="exec additional gids test => test_exec_additional_gids"
test_log=$(mktemp /tmp/additional_gids_test_XXX)
USERNAME="user"
@@ -37,10 +36,14 @@ file_info="Keep it secret, keep it safe"
function additional_gids_test()
{
local ret=0
+ local runtime=$1
+ test="exec additional gids test => test_exec_additional_gids => $runtime"
+
+ msg_info "${test} starting..."
isula rm -f `isula ps -a -q`
- isula run -tid -n $cont_name ubuntu bash
+ isula run -tid --runtime $runtime -n $cont_name ubuntu bash
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container" && ((ret++))
isula exec $cont_name bash -c "groupadd --gid $USER_GID $USERNAME \
@@ -52,10 +55,13 @@ function additional_gids_test()
&& chmod 606 /app/sekrit.txt"
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - create user and group failed" && ((ret++))
+ # runc is not support exec --workdir
/usr/bin/expect <<- EOF > ${test_log} 2>&1
set timeout 10
-spawn isula exec -it --workdir /app -u $USERNAME $cont_name bash
+spawn isula exec -it -u $USERNAME $cont_name bash
expect "${USERNAME}*"
+send "cd /app\n"
+expect "*"
send "newgrp ${ADDITIONAL_GROUP}\n"
expect "*"
send "groups\n"
@@ -75,18 +81,18 @@ EOF
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - read error message failed" && ((ret++))
isula rm -f `isula ps -a -q`
+ rm -rf ${test_log}
+
+ msg_info "${test} finished with return ${ret}..."
return ${ret}
}
declare -i ans=0
-msg_info "${test} starting..."
-
-additional_gids_test || ((ans++))
-
-rm -rf ${test_log}
-
-msg_info "${test} finished with return ${ret}..."
+for element in ${RUNTIME_LIST[@]};
+do
+ additional_gids_test $element || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/export.sh b/CI/test_cases/container_cases/export.sh
index eeef2809..1cff873d 100755
--- a/CI/test_cases/container_cases/export.sh
+++ b/CI/test_cases/container_cases/export.sh
@@ -26,7 +26,8 @@ function test_image_export()
{
local ret=0
local image="busybox"
- local test="export container test => (${FUNCNAME[@]})"
+ local runtime=$1
+ local test="export container test => (${FUNCNAME[@]}) => $runtime"
msg_info "${test} starting..."
@@ -36,7 +37,7 @@ function test_image_export()
isula images | grep busybox
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
- CONT=`isula run -itd busybox`
+ CONT=`isula run --runtime $runtime -itd busybox`
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++))
isula export -o export.tar ${CONT}
@@ -55,6 +56,9 @@ function test_image_export()
declare -i ans=0
-test_image_export || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ test_image_export $element || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/hook_ignore_poststart_error.sh b/CI/test_cases/container_cases/hook_ignore_poststart_error.sh
index 5c86a4c1..8c636f7e 100755
--- a/CI/test_cases/container_cases/hook_ignore_poststart_error.sh
+++ b/CI/test_cases/container_cases/hook_ignore_poststart_error.sh
@@ -28,7 +28,8 @@ function test_hook_ignore_poststart_error_spec()
{
local ret=0
local image="busybox"
- local test="container hook test => (${FUNCNAME[@]})"
+ local runtime=$1
+ local test="container hook test => (${FUNCNAME[@]}) => $runtime"
CONT=test_hook_spec
cp ${test_data_path}/poststart.sh /tmp/
@@ -40,7 +41,7 @@ function test_hook_ignore_poststart_error_spec()
isula images | grep busybox
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
- isula run -n $CONT -itd --hook-spec ${test_data_path}/oci_hook_poststart_check.json ${image} &
+ isula run -n $CONT -itd --runtime $runtime --hook-spec ${test_data_path}/oci_hook_poststart_check.json ${image} &
for a in `seq 20`
do
@@ -74,6 +75,9 @@ function test_hook_ignore_poststart_error_spec()
declare -i ans=0
-test_hook_ignore_poststart_error_spec || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ test_hook_ignore_poststart_error_spec $1 || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/hook_spec_test.sh b/CI/test_cases/container_cases/hook_spec_test.sh
index c88ed340..33b7c2e5 100755
--- a/CI/test_cases/container_cases/hook_spec_test.sh
+++ b/CI/test_cases/container_cases/hook_spec_test.sh
@@ -28,7 +28,8 @@ function test_hook_spec()
{
local ret=0
local image="busybox"
- local test="container hook test => (${FUNCNAME[@]})"
+ local runtime=$1
+ local test="container hook test => (${FUNCNAME[@]}) => $runtime"
msg_info "${test} starting..."
isula pull ${image}
@@ -37,7 +38,7 @@ function test_hook_spec()
isula images | grep busybox
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
- CONT=`isula run -itd --hook-spec ${test_data_path}/test-hookspec.json ${image}`
+ CONT=`isula run -itd --runtime $runtime --hook-spec ${test_data_path}/test-hookspec.json ${image}`
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++))
isula stop -t 0 ${CONT}
@@ -51,7 +52,7 @@ function test_hook_spec()
isula run -n $no_permission_container -itd --hook-spec ${test_data_path}/no_permission.json ${image} > $runlog 2>&1
[[ $? -ne 126 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to check exit code container with image: ${image}" && ((ret++))
- cat $runlog | grep "Permission denied"
+ cat $runlog | grep -i "Permission denied"
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to get no_permission output: ${image}" && ((ret++))
isula rm -f $no_permission_container
@@ -95,6 +96,9 @@ EOF
declare -i ans=0
-test_hook_spec || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ test_hook_spec $element || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/bigdata_stream.sh b/CI/test_cases/container_cases/lcr_bigdata_stream.sh
similarity index 93%
rename from CI/test_cases/container_cases/bigdata_stream.sh
rename to CI/test_cases/container_cases/lcr_bigdata_stream.sh
index 3bfc2d50..c8ecc48a 100755
--- a/CI/test_cases/container_cases/bigdata_stream.sh
+++ b/CI/test_cases/container_cases/lcr_bigdata_stream.sh
@@ -40,7 +40,7 @@ function set_up()
isula images | grep busybox
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
- CID=$(isula run -itd ${image} sh)
+ CID=$(isula run --runtime lcr -itd ${image} sh)
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++))
isula exec -it $CID dd if=/dev/zero of=test_500M bs=1M count=500
@@ -389,33 +389,6 @@ function test_stream_with_kill_isulad()
return ${ret}
}
-function test_stream_with_runc()
-{
- local ret=0
- local image="busybox"
- local test="test_stream_with_runc => (${FUNCNAME[@]})"
- msg_info "${test} starting..."
-
- RUNCID=$(isula run -itd --runtime runc ${image} sh)
- isula exec -it $RUNCID dd if=/dev/zero of=test_500M bs=1M count=500
- [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to create bigdata" && ((ret++))
-
- isula exec -it $RUNCID cat test_500M > /home/iocopy_stream_data_500M
- [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to cat bigdata" && ((ret++))
-
- sync && sync
- total_size=$(stat -c"%s" /home/iocopy_stream_data_500M)
- [[ $total_size -ne 524288000 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stream iocopy loss data" && ((ret++))
-
- isula rm -f $RUNCID
- [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm container" && ((ret++))
-
- rm -rf /home/iocopy_stream_data_500M
-
- msg_info "${test} finished with return ${ret}..."
- return ${ret}
-}
-
function tear_down()
{
local ret=0
@@ -438,7 +411,7 @@ function test_memory_leak_with_bigdata_stream()
start_isulad_with_valgrind
- CID=$(isula run -itd ${image} sh)
+ CID=$(isula run --runtime lcr -itd ${image} sh)
isula exec -it $CID dd if=/dev/zero of=test_100M bs=1M count=100
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to create bigdata" && ((ret++))
@@ -477,7 +450,6 @@ test_stream_with_stop_lxc_monitor || ((ans++))
test_stream_with_kill_lxc_monitor || ((ans++))
test_stream_with_stop_isulad || ((ans++))
test_stream_with_kill_isulad || ((ans++))
-test_stream_with_runc || ((ans++))
tear_down || ((ans++))
test_memory_leak_with_bigdata_stream || ((ans++))
diff --git a/CI/test_cases/container_cases/exec.sh b/CI/test_cases/container_cases/lcr_exec.sh
similarity index 97%
rename from CI/test_cases/container_cases/exec.sh
rename to CI/test_cases/container_cases/lcr_exec.sh
index 96ceb884..4f51773d 100755
--- a/CI/test_cases/container_cases/exec.sh
+++ b/CI/test_cases/container_cases/lcr_exec.sh
@@ -30,7 +30,7 @@ function exec_workdir()
isula rm -f `isula ps -a -q`
- isula run -tid -n cont_workdir busybox sh
+ isula run -tid --runtime lcr -n cont_workdir busybox sh
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with --workdir" && ((ret++))
isula exec -ti --workdir /workdir cont_workdir pwd | grep "/workdir"
diff --git a/CI/test_cases/container_cases/nano_cpus.sh b/CI/test_cases/container_cases/nano_cpus.sh
index c679958d..85223038 100755
--- a/CI/test_cases/container_cases/nano_cpus.sh
+++ b/CI/test_cases/container_cases/nano_cpus.sh
@@ -26,7 +26,8 @@ function test_cpu_nano_spec()
{
local ret=0
local image="busybox"
- local test="container blkio nano test => (${FUNCNAME[@]})"
+ local runtime=$1
+ local test="container blkio nano test => (${FUNCNAME[@]}) => $runtime"
msg_info "${test} starting..."
@@ -108,6 +109,9 @@ function test_cpu_nano_spec()
declare -i ans=0
-test_cpu_nano_spec || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ test_cpu_nano_spec $element || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/restart.sh b/CI/test_cases/container_cases/restart.sh
index 5902af06..fddee1f7 100755
--- a/CI/test_cases/container_cases/restart.sh
+++ b/CI/test_cases/container_cases/restart.sh
@@ -26,7 +26,8 @@ source ../helpers.sh
function do_test_t()
{
containername=test_restart
- isula run --name $containername -td busybox
+
+ isula run --runtime $1 --name $containername -td busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -46,9 +47,12 @@ function do_test_t()
ret=0
-do_test_t
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+for element in ${RUNTIME_LIST[@]};
+do
+ do_test_t $element
+ if [ $? -ne 0 ];then
+ let "ret=$ret + 1"
+ fi
+done
show_result $ret "basic restart"
diff --git a/CI/test_cases/container_cases/run.sh b/CI/test_cases/container_cases/run.sh
index ad449402..8ea3e514 100755
--- a/CI/test_cases/container_cases/run.sh
+++ b/CI/test_cases/container_cases/run.sh
@@ -25,7 +25,7 @@ source ../helpers.sh
function do_test_t()
{
- tid=`isula run -tid --name hostname busybox`
+ tid=`isula run --runtime $1 -tid --name hostname busybox`
chostname=`isula exec -it $tid hostname`
fn_check_eq "$chostname" "${tid:0:12}" "default hostname is id of container"
isula exec -it hostname env | grep HOSTNAME
@@ -37,7 +37,7 @@ function do_test_t()
containername=test_basic_run
containername2=container_to_join
- isula run --name $containername -td busybox
+ isula run --runtime $1 --name $containername -td busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -48,7 +48,7 @@ function do_test_t()
isula rm $containername
fn_check_eq "$?" "0" "rm failed"
- isula run --name $containername -td -v /dev/shm:/dev/shm busybox
+ isula run --runtime $1 --name $containername -td -v /dev/shm:/dev/shm busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -61,7 +61,7 @@ function do_test_t()
echo AA > /tmp/test_run_env
- isula run --name $containername -itd --user 100:100 -e AAA=BB -e BAA --env-file /tmp/test_run_env busybox
+ isula run --runtime $1 --name $containername -itd --user 100:100 -e AAA=BB -e BAA --env-file /tmp/test_run_env busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -72,18 +72,21 @@ function do_test_t()
isula rm $containername
fn_check_eq "$?" "0" "rm failed"
- isula run --name $containername -itd --external-rootfs / --read-only none sh
- fn_check_eq "$?" "0" "run container with host rootfs failed"
- testcontainer $containername running
+ # runc directly uses the root directory as external rootfs and will report the error pivot_root .: device or resource busy
+ if [ $runtime == "lcr" ]; then
+ isula run --runtime $1 --name $containername -itd --external-rootfs / --read-only none sh
+ fn_check_eq "$?" "0" "run container with host rootfs failed"
+ testcontainer $containername running
- isula stop -t 0 $containername
- fn_check_eq "$?" "0" "stop failed"
- testcontainer $containername exited
+ isula stop -t 0 $containername
+ fn_check_eq "$?" "0" "stop failed"
+ testcontainer $containername exited
- isula rm $containername
- fn_check_eq "$?" "0" "rm failed"
+ isula rm $containername
+ fn_check_eq "$?" "0" "rm failed"
+ fi
- isula run --name $containername -itd --net=host --pid=host --ipc=host --uts=host busybox
+ isula run --runtime $1 --name $containername -itd --net=host --pid=host --ipc=host --uts=host busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -94,7 +97,7 @@ function do_test_t()
isula rm $containername
fn_check_eq "$?" "0" "rm failed"
- isula run --name $containername -itd --net=none --pid=none --ipc=none --uts=none busybox
+ isula run --runtime $1 --name $containername -itd --net=none --pid=none --ipc=none --uts=none busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -105,11 +108,11 @@ function do_test_t()
isula rm $containername
fn_check_eq "$?" "0" "rm failed"
- isula run --name $containername2 -itd busybox
+ isula run --runtime $1 --name $containername2 -itd busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername2 running
- isula run --name $containername -itd --net=container:$containername2 --pid=container:$containername2 --ipc=container:$containername2 --uts=container:$containername2 busybox
+ isula run --runtime $1 --name $containername -itd --net=container:$containername2 --pid=container:$containername2 --ipc=container:$containername2 --uts=container:$containername2 busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -135,7 +138,7 @@ function do_run_remote_test_t()
local ret=0
local image="busybox"
local config='tcp://127.0.0.1:2890'
- local test="container start with --attach remote test => (${FUNCNAME[@]})"
+ local test="container start with --attach remote test => (${FUNCNAME[@]}) => $1"
check_valgrind_log
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++))
@@ -144,13 +147,13 @@ function do_run_remote_test_t()
containername=run_remote
- isula run -ti -H "$config" --name $containername busybox xxx
+ isula run --runtime $1 -ti -H "$config" --name $containername busybox xxx
[[ $? -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed check invalid run ${containername} remote" && ((ret++))
testcontainer $containername exited
isula rm -f -H "$config" $containername
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm container remote" && ((ret++))
- isula run -ti -H "$config" --name $containername busybox /bin/sh -c 'echo "hello"' | grep hello
+ isula run --runtime $1 -ti -H "$config" --name $containername busybox /bin/sh -c 'echo "hello"' | grep hello
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run ${containername} remote" && ((ret++))
testcontainer $containername exited
@@ -169,8 +172,10 @@ function do_run_remote_test_t()
declare -i ans=0
-do_test_t || ((ans++))
-
-do_run_remote_test_t || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ do_test_t $element || ((ans++))
+ do_run_remote_test_t $element || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/bigdata_stream_runc.sh b/CI/test_cases/container_cases/runc_bigdata_stream.sh
similarity index 100%
rename from CI/test_cases/container_cases/bigdata_stream_runc.sh
rename to CI/test_cases/container_cases/runc_bigdata_stream.sh
diff --git a/CI/test_cases/container_cases/exec_runc.sh b/CI/test_cases/container_cases/runc_exec.sh
similarity index 100%
rename from CI/test_cases/container_cases/exec_runc.sh
rename to CI/test_cases/container_cases/runc_exec.sh
diff --git a/CI/test_cases/container_cases/seccomp.sh b/CI/test_cases/container_cases/seccomp.sh
index 9e886d10..3cb08d84 100755
--- a/CI/test_cases/container_cases/seccomp.sh
+++ b/CI/test_cases/container_cases/seccomp.sh
@@ -39,8 +39,9 @@ function do_pre() {
function do_test() {
local ret=0
-
- msg_info "this is $0 do_test"
+ local runtime=$1
+ local test="seccomp test => (${runtime})"
+ msg_info "${test} starting..."
cid1=$(isula run -tid --security-opt seccomp=/etc/isulad/seccomp_default.json busybox sh)
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Failed to run container with the default seccomp profile" && ((ret++))
@@ -52,7 +53,7 @@ function do_test() {
--security-opt seccomp=${test_data_path}/seccomp_profile_without_archmap.json busybox sh)
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Failed to run container with multiple seccomp profiles" && ((ret++))
- isula stop "${cid1}" "${cid2}" "${cid3}"
+ isula stop -t 0 "${cid1}" "${cid2}" "${cid3}"
isula rm -f $(isula ps -qa)
@@ -69,7 +70,10 @@ declare -i ans=0
do_pre || ((ans++))
-do_test || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ do_test $element || ((ans++))
+done
do_post
diff --git a/CI/test_cases/container_cases/stop.sh b/CI/test_cases/container_cases/stop.sh
index 962e72f3..13292710 100755
--- a/CI/test_cases/container_cases/stop.sh
+++ b/CI/test_cases/container_cases/stop.sh
@@ -25,8 +25,12 @@ source ../helpers.sh
function do_test_t()
{
+ local runtime=$1
+ local test="start_test => (${runtime})"
+ msg_info "${test} starting..."
+
containername=test_stop
- isula run --name $containername -td busybox
+ isula run --runtime $runtime --name $containername -td busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -61,14 +65,19 @@ function do_test_t()
isula rm $containername
fn_check_eq "$?" "0" "rm failed"
+ msg_info "${test} finished with return ${ret}..."
+
return $TC_RET_T
}
ret=0
-do_test_t
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+for element in ${RUNTIME_LIST[@]};
+do
+ do_test_t $element
+ if [ $? -ne 0 ];then
+ let "ret=$ret + 1"
+ fi
+done
show_result $ret "basic stop"
diff --git a/CI/test_cases/critest.sh b/CI/test_cases/critest.sh
index 044ce2ed..f8d4975e 100755
--- a/CI/test_cases/critest.sh
+++ b/CI/test_cases/critest.sh
@@ -130,7 +130,7 @@ function test_critest() {
function do_test_t() {
local ret=0
- local runtime="lcr"
+ local runtime="runc"
local test="critest => $runtime"
msg_info "${test} starting..."
echo "${test}" >> ${testcase_data}/critest.log
@@ -143,11 +143,11 @@ function do_test_t() {
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++))
# replace default runtime
- sed -i 's/"default-runtime": "lcr"/"default-runtime": "runc"/g' /etc/isulad/daemon.json
+ sed -i 's/"default-runtime": "runc"/"default-runtime": "lcr"/g' /etc/isulad/daemon.json
start_isulad_without_valgrind --selinux-enabled --network-plugin cni
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - start isulad with selinux and cni failed" && ((ret++))
- runtime=runc
+ runtime=lcr
test="critest => $runtime"
msg_info "${test} starting..."
echo "${test}" >> ${testcase_data}/critest.log
--
2.42.0
|