File: spread.yaml

package info (click to toggle)
snapd 2.68.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 76,812 kB
  • sloc: sh: 15,703; ansic: 15,630; python: 6,278; makefile: 1,842; exp: 190; xml: 22
file content (1499 lines) | stat: -rw-r--r-- 62,147 bytes parent folder | download
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
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
project: snapd

environment:
    GOHOME: /home/gopath
    GOPATH: $GOHOME
    # On some distros the default GOPROXY setting is 'direct' (eg. Fedora).
    # Some of the external go packages may get removed or could be temporary
    # offline (as happened with maze.io/x/crypt), and then the sources are
    # only available through the proxy cache. Play it safe and enable the
    # proxy to allow for least CI interruptions.
    GOPROXY: https://proxy.golang.org,direct
    REUSE_PROJECT: '$(HOST: echo "$REUSE_PROJECT")'
    PROJECT_PATH: $GOHOME/src/github.com/snapcore/snapd
    PATH: $PROJECT_PATH/tests/bin:$GOHOME/bin:/snap/bin:$PATH:/var/lib/snapd/snap/bin
    TESTSLIB: $PROJECT_PATH/tests/lib
    TESTSTOOLS: $PROJECT_PATH/tests/lib/tools
    TESTSTMP: /var/tmp/snapd-tools
    RUNTIME_STATE_PATH: $TESTSTMP/runtime-state
    # turn debug off so that we don't get errant debug messages while running
    # tests, and in some cases like on UC20 we have the kernel command line
    # parameter, snapd.debug=1 turned on to enable early boot debugging before
    # we have a shell, but then once we get a shell and run spread tests, we
    # want debug messages to be off for commands we run as part of tests, unless
    # tests explicitly turn the messages on
    SNAPD_DEBUG: 0
    SNAPPY_TESTING: 1
    # we run the entire suite with re-exec on (the default) and modify
    # the core snap so that it contains our new code.  So we run new
    # snapd from the deb that re-execs into new snapd in core.  To
    # test purely from the deb, set "export SPREAD_SNAP_REEXEC=0"
    SNAP_REEXEC: '$(HOST: echo "${SPREAD_SNAP_REEXEC:-}")'
    MODIFY_CORE_SNAP_FOR_REEXEC: '$(HOST: echo "${SPREAD_MODIFY_CORE_SNAP_FOR_REEXEC:-1}")'
    SPREAD_STORE_USER: '$(HOST: echo "$SPREAD_STORE_USER")'
    SPREAD_STORE_PASSWORD: '$(HOST: echo "$SPREAD_STORE_PASSWORD")'
    SPREAD_STORE_EXPIRED_MACAROON: '$(HOST: echo "$SPREAD_STORE_EXPIRED_MACAROON")'
    SPREAD_STORE_EXPIRED_DISCHARGE: '$(HOST: echo "$SPREAD_STORE_EXPIRED_DISCHARGE")'
    SPREAD_DEBUG_EACH: '$(HOST: echo "${SPREAD_DEBUG_EACH:-1}")'
    LANG: "C.UTF-8"
    LANGUAGE: "en"
    # important to ensure adhoc and linode/qemu behave the same
    SUDO_USER: ""
    SUDO_UID: ""
    TRUST_TEST_KEYS: '$(HOST: echo "${SPREAD_TRUST_TEST_KEYS:-true}")'
    # a global setting for LXD channel to use in the tests
    LXD_SNAP_CHANNEL: "latest/candidate"
    OLD_UBUNTU_IMAGE_SNAP_CHANNEL: "2/stable"
    UBUNTU_IMAGE_SNAP_CHANNEL: "latest/beta"
    SNAPCRAFT_SNAP_CHANNEL: "latest/candidate"
    # controls whether ubuntu-image is built using the current snapd tree as a
    # dependency or the one listed in its go.mod
    UBUNTU_IMAGE_ALLOW_API_BREAK: '$(HOST: echo "${SPREAD_UBUNTU_IMAGE_ALLOW_API_BREAK:-true}")'
    CORE_CHANNEL: '$(HOST: echo "${SPREAD_CORE_CHANNEL:-edge}")'
    BASE_CHANNEL: '$(HOST: echo "${SPREAD_BASE_CHANNEL:-edge}")'
    # Channel for kernel cannot be edge as that one is not signed with Canonical keys
    KERNEL_CHANNEL: '$(HOST: echo "${SPREAD_KERNEL_CHANNEL:-beta}")'
    GADGET_CHANNEL: '$(HOST: echo "${SPREAD_GADGET_CHANNEL:-beta}")'
    SNAPD_CHANNEL: '$(HOST: echo "${SPREAD_SNAPD_CHANNEL:-edge}")'
    REMOTE_STORE: '$(HOST: echo "${SPREAD_REMOTE_STORE:-production}")'
    SNAPPY_USE_STAGING_STORE: '$(HOST: if [ "$SPREAD_REMOTE_STORE" = staging ]; then echo 1; else echo 0; fi)'
    DELTA_REF: 2.62
    DELTA_PREFIX: snapd-$DELTA_REF/
    REPACK_KEEP_VENDOR: '$(HOST: echo "${REPACK_KEEP_VENDOR:-n}")'    
    HTTP_PROXY: '$(HOST: echo "$SPREAD_HTTP_PROXY")'
    HTTPS_PROXY: '$(HOST: echo "$SPREAD_HTTPS_PROXY")'
    NO_PROXY: "127.0.0.1"
    NEW_CORE_CHANNEL: '$(HOST: echo "$SPREAD_NEW_CORE_CHANNEL")'
    SRU_VALIDATION: '$(HOST: echo "${SPREAD_SRU_VALIDATION:-0}")'
    # use the ppa_validation_name to install snapd from a public ppa
    PPA_VALIDATION_NAME: '$(HOST: echo "${SPREAD_PPA_VALIDATION_NAME:-}")'
    # use the ppa_source_line and ppa_gpg_key to install snapd from a private ppa
    PPA_SOURCE_LINE: '$(HOST: echo "${SPREAD_PPA_SOURCE_LINE:-}")'
    PPA_GPG_KEY: '$(HOST: echo "${SPREAD_PPA_GPG_KEY:-}")'
    # List the snaps which are cached
    PRE_CACHE_SNAPS: test-snapd-tools test-snapd-sh
    # always skip removing the rsync snap
    SKIP_REMOVE_SNAPS: '$(HOST: echo "${SPREAD_SKIP_REMOVE_SNAPS:-}") test-snapd-rsync test-snapd-rsync-core18 test-snapd-rsync-core20 test-snapd-rsync-core22 test-snapd-rsync-core24'
    # Use the installed snapd and reset the systems without removing snapd
    REUSE_SNAPD: '$(HOST: echo "${SPREAD_REUSE_SNAPD:-0}")'
    EXPERIMENTAL_FEATURES: '$(HOST: echo "${SPREAD_EXPERIMENTAL_FEATURES:-}")'
    # set to 1 when the snapd memory limit has to be removed
    SNAPD_NO_MEMORY_LIMIT: '$(HOST: echo "${SPREAD_SNAPD_NO_MEMORY_LIMIT:-}")'

    # Use the snapd package from the repository when possible
    SNAPD_DEB_FROM_REPO: '$(HOST: echo "${SPREAD_SNAPD_DEB_FROM_REPO:-true}")'
    # Directory where the built snapd snaps and other assets are stored
    SNAPD_WORK_DIR: '$(HOST: echo "${SPREAD_SNAPD_WORK_DIR:-/var/tmp/work-dir}")'
    # Threshold used to determine which stake locks have to be collected during runtime
    SNAPD_STATE_LOCK_TRACE_THRESHOLD_MS: '$(HOST: echo "${SPREAD_SNAPD_STATE_LOCK_TRACE_THRESHOLD_MS:-0}")'
    # Allow mismatch in snapd/kernel versions
    SNAPD_ALLOW_SNAPD_KERNEL_MISMATCH: '$(HOST: echo "${SNAPD_ALLOW_SNAPD_KERNEL_MISMATCH:-true}")'

    # Directory where the nested images and test assets are stored
    NESTED_WORK_DIR: '$(HOST: echo "${NESTED_WORK_DIR:-/var/tmp/work-dir}")'
    # Channel used to create the nested vm
    NESTED_CORE_CHANNEL: '$(HOST: echo "${NESTED_CORE_CHANNEL:-beta}")'
    # Kernel channel used to create the nested vm
    NESTED_KERNEL_CHANNEL: '$(HOST: echo "${NESTED_KERNEL_CHANNEL:-beta}")'
    # Gadget channel used to create the nested vm
    NESTED_GADGET_CHANNEL: '$(HOST: echo "${NESTED_GADGET_CHANNEL:-edge}")'
    # Use cloud init to make initial system configuration instead of user assertion
    NESTED_CORE_REFRESH_CHANNEL: '$(HOST: echo "${NESTED_CORE_REFRESH_CHANNEL:-edge}")'
    # Use cloud init to make initial system configuration instead of user assertion
    NESTED_USE_CLOUD_INIT: '$(HOST: echo "${NESTED_USE_CLOUD_INIT:-true}")'
    # Build and use snapd from current branch
    NESTED_BUILD_SNAPD_FROM_CURRENT: '$(HOST: echo "${NESTED_BUILD_SNAPD_FROM_CURRENT:-true}")'
    # Download and use an custom image from this url
    NESTED_CUSTOM_IMAGE_URL: '$(HOST: echo "${NESTED_CUSTOM_IMAGE_URL:-}")'
    # Configure nested images to be reused on the following tests
    NESTED_CONFIGURE_IMAGES: '$(HOST: echo "${NESTED_CONFIGURE_IMAGES:-false}")'
    # Indicates if the snap has to be repacked in case NESTED_BUILD_SNAPD_FROM_CURRENT is true
    NESTED_REPACK_KERNEL_SNAP: '$(HOST: echo "${NESTED_REPACK_KERNEL_SNAP:-true}")'
    NESTED_REPACK_GADGET_SNAP: '$(HOST: echo "${NESTED_REPACK_GADGET_SNAP:-true}")'
    NESTED_REPACK_BASE_SNAP: '$(HOST: echo "${NESTED_REPACK_BASE_SNAP:-true}")'
    NESTED_KERNEL_MODULES_COMP: '$(HOST: echo "${NESTED_KERNEL_MODULES_COMP:-}")'
    
    # Whether we should use snapd snap ./built-snap/ directory
    USE_PREBUILT_SNAPD_SNAP: '$(HOST: echo "${SPREAD_USE_PREBUILT_SNAPD_SNAP:-false}")'
    USE_SNAPD_SNAP_URL: '$(HOST: echo "${SPREAD_USE_SNAPD_SNAP_URL:-}")'

backends:
    google:
        key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
        location: snapd-spread/europe-west2-b
        halt-timeout: 2h
        systems:
            - ubuntu-14.04-64:
                  workers: 6
            - ubuntu-16.04-64:
                  workers: 8
                  storage: 15G
            - ubuntu-18.04-64:
                  storage: 15G
                  workers: 8
            - ubuntu-20.04-64:
                  storage: 15G
                  workers: 8
            - ubuntu-secboot-20.04-64:
                  image: ubuntu-20.04-64
                  workers: 1
                  secure-boot: true
            - ubuntu-22.04-64:
                  storage: 15G
                  workers: 8
            - ubuntu-24.04-64:
                  storage: 15G
                  workers: 8
            - ubuntu-24.10-64:
                  storage: 15G
                  workers: 8
            - ubuntu-25.04-64:
                  image: ubuntu-os-cloud-devel/ubuntu-2504-amd64
                  storage: 15G
                  workers: 8

    google-core:
        type: google
        key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
        location: snapd-spread/europe-west1-b
        halt-timeout: 2h
        systems:
            - ubuntu-core-16-64:
                  image: ubuntu-16.04-64
                  workers: 6
                  storage: 20G
            - ubuntu-core-18-64:
                  image: ubuntu-18.04-64
                  workers: 6
                  storage: 20G
            - ubuntu-core-20-64:
                  image: ubuntu-20.04-64
                  workers: 8
                  storage: 20G
            - ubuntu-core-22-64:
                  image: ubuntu-22.04-64
                  workers: 8
                  storage: 20G
            - ubuntu-core-24-64:
                  image: ubuntu-24.04-64
                  workers: 8
                  storage: 20G

    google-pro:
        type: google
        # XXX the role assigned to the key must allow for attaching service
        # accounts
        key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
        location: snapd-spread/europe-west1-b
        halt-timeout: 2h
        systems:
            - ubuntu-pro-20.04-64:
                  image: ubuntu-os-pro-cloud/ubuntu-pro-2004-lts
                  workers: 1
                  attach-service-account: true

            - ubuntu-pro-22.04-64:
                  image: ubuntu-os-pro-cloud/ubuntu-pro-2204-lts
                  workers: 1
                  attach-service-account: true

            - ubuntu-fips-20.04-64:
                  image: ubuntu-os-pro-cloud/ubuntu-pro-2004-lts
                  workers: 1
                  attach-service-account: true

            - ubuntu-fips-22.04-64:
                  image: ubuntu-os-pro-cloud/ubuntu-pro-2204-lts
                  workers: 1
                  attach-service-account: true

    google-distro-1:
        type: google
        key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
        location: snapd-spread/europe-west3-b
        halt-timeout: 2h
        systems:
            - debian-11-64:
                  workers: 6
            - debian-12-64:
                  workers: 6
            - debian-sid-64:
                  storage: 12G
                  workers: 6

            - amazon-linux-2-64:
                  workers: 6
                  storage: preserve-size
            - amazon-linux-2023-64:
                  workers: 6
                  storage: preserve-size

    google-distro-2:
        type: google
        key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
        location: snapd-spread/europe-west4-b
        halt-timeout: 2h
        systems:
            - arch-linux-64:
                  workers: 6
                  storage: 15G

            - centos-9-64:
                  workers: 6
                  storage: preserve-size
                  image: centos-9-64

            - opensuse-15.6-64:
                  workers: 6
            - opensuse-tumbleweed-64:
                  workers: 6
                  storage: 12G

    google-arm:
        type: google
        key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
        location: snapd-spread/us-central1-a
        plan: t2a-standard-1
        halt-timeout: 2h
        kill-timeout: 60m
        systems:
            - ubuntu-20.04-arm-64:
                  image: ubuntu-os-cloud/ubuntu-2004-lts-arm64
                  workers: 8
                  storage: 15G
            - ubuntu-22.04-arm-64:
                  image: ubuntu-os-cloud/ubuntu-2204-lts-arm64
                  workers: 8
                  storage: 15G
            - ubuntu-core-22-arm-64:
                  image: ubuntu-22.04-arm-64
                  workers: 6
                  storage: 30G

    google-sru:
        type: google
        key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
        location: snapd-spread/us-central1-a
        halt-timeout: 2h
        systems:
            - ubuntu-20.04-64:
                  storage: 12G
                  workers: 8
            - ubuntu-22.04-64:
                  storage: 12G
                  workers: 8
            - ubuntu-24.04-64:
                  storage: 12G
                  workers: 8
            - ubuntu-24.10-64:
                  storage: 12G
                  workers: 8

    google-nested:
        type: google
        key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
        location: snapd-spread/us-central1-a
        plan: n2-standard-2
        halt-timeout: 2h
        cpu-family: "Intel Cascade Lake"
        systems: &google-nested-systems
            - ubuntu-16.04-64:
                  image: ubuntu-1604-64-virt-enabled
                  storage: 20G
                  workers: 4
            - ubuntu-18.04-64:
                  image: ubuntu-1804-64-virt-enabled
                  storage: 20G
                  workers: 4
            - ubuntu-20.04-64:
                  image: ubuntu-2004-64-virt-enabled
                  storage: 20G
                  workers: 12
            - ubuntu-22.04-64:
                  image: ubuntu-2204-64-virt-enabled
                  storage: 25G
                  workers: 14
            - ubuntu-24.04-64:
                  image: ubuntu-2404-64-virt-enabled
                  storage: 25G
                  workers: 14

    google-nested-arm:
        type: google
        key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
        location: snapd-spread/us-central1-a
        plan: t2a-standard-2
        halt-timeout: 2h
        systems:
            - ubuntu-22.04-arm-64:
                  image: ubuntu-2204-arm-64-virt-enabled
                  storage: 25G
                  workers: 8

    google-nested-dev:
        type: google
        key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
        location: snapd-spread/northamerica-northeast1-a
        plan: n2-standard-4
        halt-timeout: 6h
        cpu-family: "Intel Cascade Lake"
        systems: *google-nested-systems

    qemu-nested:
        memory: 4G
        type: qemu
        systems:
            - ubuntu-16.04-64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-18.04-64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-20.04-64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-22.04-64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-24.04-64:
                  username: ubuntu
                  password: ubuntu

    qemu:
        memory: 4G
        systems:
            - ubuntu-14.04-64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-16.04-64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-core-16-64:
                  image: ubuntu-16.04-64
                  username: ubuntu
                  password: ubuntu
            - ubuntu-core-18-64:
                  image: ubuntu-18.04-64
                  username: ubuntu
                  password: ubuntu
            - ubuntu-core-20-64:
                  image: ubuntu-20.04-64
                  username: ubuntu
                  password: ubuntu
                  bios: uefi
                  # TODO: remove once everyone switch to official spread
                  flags: [virtio]
            - ubuntu-core-22-64:
                  image: ubuntu-22.04-64
                  username: ubuntu
                  password: ubuntu
                  bios: uefi
                  # TODO: remove once everyone switch to official spread
                  flags: [virtio]
            - ubuntu-18.04-64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-20.04-64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-22.04-64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-24.04-64:
                  username: ubuntu
                  password: ubuntu
            - debian-11-64:
                  username: debian
                  password: debian
            - debian-12-64:
                  username: debian
                  password: debian
            - debian-sid-64:
                  username: debian
                  password: debian
            - amazon-linux-2-64:
                  username: ec2-user
                  password: ec2-user
            - opensuse-tumbleweed-64:
                  username: opensuse
                  password: opensuse
    autopkgtest:
        type: adhoc
        allocate: |
            echo "Allocating ad-hoc $SPREAD_SYSTEM"
            if [ -z "${ADT_ARTIFACTS}" ]; then
                FATAL "adhoc only works inside autopkgtest"
                exit 1
            fi
            ADDRESS localhost:22
        discard: |
            echo "Discarding ad-hoc $SPREAD_SYSTEM"
        systems:
            # Trusty
            - ubuntu-14.04-amd64:
                  username: ubuntu
                  password: ubuntu
            # Xenial
            - ubuntu-16.04-amd64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-16.04-ppc64el:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-16.04-armhf:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-16.04-s390x:
                  username: ubuntu
                  password: ubuntu
            # Bionic
            - ubuntu-18.04-amd64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-18.04-ppc64el:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-18.04-armhf:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-18.04-s390x:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-18.04-arm64:
                  username: ubuntu
                  password: ubuntu
            # Focal
            - ubuntu-20.04-amd64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-20.04-ppc64el:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-20.04-armhf:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-20.04-s390x:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-20.04-arm64:
                  username: ubuntu
                  password: ubuntu
            # Jammy
            - ubuntu-22.04-amd64:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-22.04-ppc64el:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-22.04-armhf:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-22.04-s390x:
                  username: ubuntu
                  password: ubuntu
            - ubuntu-22.04-arm64:
                  username: ubuntu
                  password: ubuntu
            # Debian Trixie
            - debian-13-amd64:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            - debian-13-i386:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            - debian-13-armhf:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            - debian-13-ppc64el:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            - debian-13-s390x:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            - debian-13-arm64:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            # Debian Sid
            - debian-sid-amd64:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            - debian-sid-i386:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            - debian-sid-armhf:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            - debian-sid-ppc64el:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            - debian-sid-s390x:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
            - debian-sid-arm64:
                  username: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'
                  password: '$(HOST: echo "$AUTOPKGTEST_NORMAL_USER")'

    external:
        type: adhoc
        environment:
            SPREAD_EXTERNAL_ADDRESS: '$(HOST: echo "${SPREAD_EXTERNAL_ADDRESS:-localhost:8022}")'
            TRUST_TEST_KEYS: "false"
        allocate: |
            ADDRESS $SPREAD_EXTERNAL_ADDRESS
        systems:
            - ubuntu-core-16-64:
                  username: external
                  password: ubuntu123
            - ubuntu-core-16-32:
                  username: external
                  password: ubuntu123
            - ubuntu-core-16-arm-64:
                  username: external
                  password: ubuntu123
            - ubuntu-core-16-arm-32:
                  username: external
                  password: ubuntu123
            - ubuntu-core-18-64:
                  username: external
                  password: ubuntu123
            - ubuntu-core-18-32:
                  username: external
                  password: ubuntu123
            - ubuntu-core-18-arm-64:
                  username: external
                  password: ubuntu123
            - ubuntu-core-18-arm-32:
                  username: external
                  password: ubuntu123
            - ubuntu-core-20-64:
                  username: external
                  password: ubuntu123
            - ubuntu-core-20-arm-64:
                  username: external
                  password: ubuntu123
            - ubuntu-core-20-arm-32:
                  username: external
                  password: ubuntu123
            - ubuntu-core-22-64:
                  username: external
                  password: ubuntu123
            - ubuntu-core-22-arm-64:
                  username: external
                  password: ubuntu123
            - ubuntu-core-22-arm-32:
                  username: external
                  password: ubuntu123
            - ubuntu-core-24-64:
                  username: external
                  password: ubuntu123
            - ubuntu-core-24-arm-64:
                  username: external
                  password: ubuntu123

path: /home/gopath/src/github.com/snapcore/snapd

exclude:
    - .git
    - cmd/snap/snap
    - cmd/snapd/snapd
    - cmd/snapctl/snapctl
    - cmd/snap-exec/snap-exec
    - cmd/autom4te.cache
    - "*.o"
    - "*.a"
    - "*.pyc"
    - ./vendor
    - "*.snap"

debug-each: |
    if [ "$SPREAD_DEBUG_EACH" != 1 ]; then
        exit
    fi

    #shellcheck source=tests/lib/state.sh
    . "$TESTSLIB/state.sh"
    #shellcheck source=tests/lib/systems.sh
    . "$TESTSLIB/systems.sh"

    echo '# System information'
    cat /etc/os-release || true

    echo '# Kernel information'
    uname -a

    echo '# Apparmor information'
    apparmor_parser --version || true

    echo '# Go information'
    go version || true

    if tests.nested is-nested; then
        echo '# free space on the host'
        df -h || true
        du -ch /var/tmp/work-dir || true

        echo '# nested VM status'
        tests.nested vm status
        # filter out ^[ to ensure that the debug output gets not messed up
        tests.nested get serial-log | sed 's/\x1b//g'
        # add another echo in case the serial log is missing a newline
        echo

        remote.exec "sudo journalctl --no-pager -u snapd" || true

        exit
    fi

    echo "# definition of snapd.service"
    systemctl cat snapd.service || true
    echo "# status of snapd service"
    systemctl status snapd.service || true
    echo "# memory limits of snapd service that systemd uses"
    systemctl show snapd.service | grep -e MemoryMax= -e MemoryLimit= || true
    echo "# memory limits of snapd service that are actually set"
    cat /sys/fs/cgroup/memory/system.slice/snapd.service/memory.limit_in_bytes || true
    echo '# journal messages for snapd'
    "$TESTSTOOLS"/journal-state get-log -u snapd

    echo '# user sessions information'
    journalctl --user -u snapd.session-agent.service || true
    systemctl status --user snapd.session-agent  || true

    if ! is_cgroupv2; then
        # dump any information on device cgroup of current session
        cgroup_dev="$(awk -F: '/:devices:/ { print $3}' < /proc/self/cgroup || true)"
        if [ -n "$cgroup_dev" ]; then
            echo "# device cgroup $cgroup_dev"
            cat "/sys/fs/cgroup/devices/$cgroup_dev/devices.list" || true
        fi
    else
        echo "# snap confinement device filtering maps"
        ls -l /sys/fs/bpf/snap || true
    fi

    case "$SPREAD_SYSTEM" in
        fedora-*|centos-*|amazon-*)
            if [ -e "$RUNTIME_STATE_PATH/audit-stamp" ]; then
                ausearch -i -m AVC --checkpoint "$RUNTIME_STATE_PATH/audit-stamp" --start checkpoint || true
            else
                ausearch -i -m AVC || true
            fi
            (
                find /root/snap -printf '%Z\t%H/%P\n' || true
                find /home -regex '/home/[^/]*/snap\(/.*\)?' -printf '%Z\t%H/%P\n' || true
            ) | grep -v snappy_home_t || true
            find /var/snap -printf '%Z\t%H/%P\n' | grep -v snappy_var_t || true
            ;;
        opensuse-*)
            echo '# apparmor denials logged by auditd'
            ausearch -m AVC | grep DENIED || true
            ;;
        *)
            echo '# apparmor denials '
            dmesg --ctime | grep DENIED || true
            ;;
    esac
    echo '# seccomp denials (kills) '
    dmesg --ctime | grep type=1326 || true
    echo '# snap connections --all'
    snap connections --all || true
    echo '# free space'
    df -h || true
    echo '# mounts'
    # use ascii output to prevent travis from messing up the encoding
    findmnt --ascii -o+PROPAGATION || true
    echo "# processes"
    ps axl
    echo "# /var/lib/snapd"
    find /var/lib/snapd/ -not -path '/var/lib/snapd/snap/*' -ls || true
    echo '# system journal messages'
    journalctl -e

    # Keep it as the last step in debug-each
    echo '# tasks executed on system'
    if [ -f "$RUNTIME_STATE_PATH/runs" ]; then
        echo "EXECUTED_TESTS=$(cat $RUNTIME_STATE_PATH/runs)"
    fi
    # Add new line at the end of the debug output
    echo ''

rename:
    # Move content into a directory, so that deltas computed by repack benefit
    # from the content looking similar to codeload.github.com.
    - s,^,$DELTA_PREFIX,S

repack: |
    # For Linode, compute a delta based on a known git reference that can be
    # obtained directly from GitHub. There's nothing special about that reference,
    # other than it will often be in the local repository's history already.
    # The more recent the reference, the smaller the delta.
    if ! echo "$SPREAD_BACKENDS" | grep -e linode -e google; then
        cat <&3 >&4
    elif ! git show-ref "$DELTA_REF" > /dev/null; then
        cat <&3 >&4
    elif [ -n "${NO_DELTA-}" ]; then
        # delta has been disabled by the caller
        cat <&3 >&4
    else
        tmpdir="$(mktemp -d)"
        #shellcheck disable=SC2064
        trap "rm -rf delta-ref.tar current.delta repacked-current.tar $tmpdir" EXIT
        if [ "$REPACK_KEEP_VENDOR" = "n" ]; then
            tar -C "$tmpdir" -xvf - <&3
            rm -rf "$tmpdir"/$DELTA_PREFIX/vendor/*
            tar -C "$tmpdir" -c "$DELTA_PREFIX" --sort=name > repacked-current.tar
        else
            cat <&3 > repacked-current.tar
        fi
        git archive -o delta-ref.tar --format=tar --prefix="$DELTA_PREFIX" "$DELTA_REF"
        xdelta3 -S none -s delta-ref.tar repacked-current.tar > current.delta
        tar c current.delta >&4
    fi

kill-timeout: 30m

prepare: |
    # NOTE: This part of the code needs to be in spread.yaml as it runs before
    # the rest of the source code (including the tests/lib directory) is
    # around. The purpose of this code is to fix some connectivity issues and
    # then apply the delta of the git repository.

    # apt update is hanging on security.ubuntu.com with IPv6, prefer IPv4 over IPv6
    cat <<EOF > gai.conf
    precedence  ::1/128       50
    precedence  ::/0          40
    precedence  2002::/16     30
    precedence ::/96          20
    precedence ::ffff:0:0/96 100
    EOF
    if ! mv gai.conf /etc/gai.conf; then
        echo "/etc/gai.conf is not writable, ubuntu-core system? apt update won't be affected in that case"
        rm -f gai.conf
    fi
    if command -v restorecon ; then
        # restore proper context otherwise SELinux may complain
        restorecon -v /etc/gai.conf
    fi

    # Note that os.query or any other tool cannot be used here before the current.delta file is unpacked
    if [[ "$SPREAD_SYSTEM" == fedora-* ]]; then
        dnf --refresh -y makecache

        # enable audit daemon
        systemctl enable --now auditd.service
    fi

    if [[ "$SPREAD_SYSTEM" == opensuse-* ]]; then
        # refresh metadatadata
        # Auto import gpg keys needed for could repository added to support google backend
        zypper --gpg-auto-import-keys ref
        # We seem to be hitting a flaky openSUSE mirror from time to time,
        # increase the number of download attempts libzypp will try to
        # workaround that.
        cat <<-EOF >> /etc/zypp/zypp.conf
    # added by spread tests
    download.max_silent_tries = 20
    EOF

        # Make sure docs are installed with the packages
        sed 's/rpm.install.excludedocs = yes/rpm.install.excludedocs = no/g' -i /etc/zypp/zypp.conf
    fi

    if [[ "$SPREAD_SYSTEM" == arch-* ]]; then
        # Possible that AppArmor was not started and is not enabled in the
        # image, do both now
        if systemctl show -p LoadState apparmor.service | MATCH 'LoadState=loaded' ; then
            if ! systemctl is-enabled apparmor.service; then
                systemctl enable apparmor.service
            fi
            systemctl start apparmor.service
        else
            exit 1
        fi
        # workaround for https://warthogs.atlassian.net/browse/SNAPDENG-34591
        awk '/\[community\]/ {print "#" $0; getline; print "#" $0; next} {print}' < /etc/pacman.conf > /etc/pacman.conf.spread
        mv /etc/pacman.conf.spread /etc/pacman.conf
    fi

    if [[ "$SPREAD_SYSTEM" == debian-* ]]; then
        apt-get update && apt-get install -y eatmydata
    fi

    if [[ "$SPREAD_SYSTEM" == ubuntu-fips-* ]]; then
        pro status

        if [[ "$SPREAD_REBOOT" = 0 ]]; then
            echo "--- enabling FIPS"
            pro enable fips-updates --assume-yes
            REBOOT
        fi

        if ! [ "$(cat /proc/sys/crypto/fips_enabled)" = "1" ]; then
            echo "FIPS not enabled"
            exit 1
        fi

        # enable GO FIPS PPA
        add-apt-repository --yes ppa:ubuntu-toolchain-r/golang-fips
        # XXX pin priority?
        apt update
    fi

    # Enable EPEL see https://docs.fedoraproject.org/en-US/epel/
    case "$SPREAD_SYSTEM" in
        centos-9-*)
            dnf config-manager --set-enabled crb
            dnf install -y epel-release epel-next-release
            ;;
    esac

    case "$SPREAD_SYSTEM" in
        ubuntu-*|debian-*)
            # make sure unattended-upgrades does not get in the way
            if systemctl is-enabled unattended-upgrades.service; then
                systemctl stop unattended-upgrades.service
                systemctl mask unattended-upgrades.service
            fi
            ;;
    esac

    # Make sure ssh service is restarted after it is killed by spread (pkill -o -HUP sshd)
    # during the machine setup in google systems. For more details see lp:2011458
    if [[ "$SPREAD_BACKEND" =~ google ]] && [[ "$SPREAD_SYSTEM" == ubuntu-2* ]] && ! systemctl is-active ssh; then
        systemctl restart ssh
    fi

    # Unpack delta, or move content out of the prefixed directory (see rename and repack above).
    # (needs to be in spread.yaml directly because there's nothing else on the filesystem yet)
    if [ -f current.delta ]; then
        tf=$(mktemp)
        # NOTE: We can't use tests/lib/pkgdb.sh here as it doesn't exist at
        # this time when none of the test files is yet in place.
        case "$SPREAD_SYSTEM" in
            ubuntu-*|debian-*)
                apt-get update >& "$tf" || ( cat "$tf"; exit 1 )
                apt-get install -y xdelta3 curl eatmydata >& "$tf" || ( cat "$tf"; exit 1 )
                ;;
            amazon-linux-2023-*)
                echo "deltas are not supported on $SPREAD_SYSTEM, use NO_DELTA=1 when running spread"
                exit 1
                ;;
            amazon-*)
                yum install -y xdelta curl &> "$tf" || (cat "$tf"; exit 1)
                ;;
            fedora-*|centos-*)
                dnf install --refresh -y xdelta curl &> "$tf" || (cat "$tf"; exit 1)
                ;;
            opensuse-*)
                zypper -q --gpg-auto-import-keys refresh
                zypper -q install -y xdelta3 curl &> "$tf" || (cat "$tf"; exit 1)
                ;;
            arch-*)
                # there may be a libc upgrade which only -Syu handles;
                # ignore linux kernel as we would fail to detect it and handle
                # reboot; actual distro upgrade is done later in prepare.
                pacman -Syu --noconfirm xdelta3 curl --ignore linux &> "$tf" || (cat "$tf"; exit 1)
                ;;
        esac
        rm -f "$tf"
        curl -sS -o - "https://codeload.github.com/snapcore/snapd/tar.gz/$DELTA_REF" | gunzip > delta-ref.tar
        xdelta3 -q -c -d -s delta-ref.tar current.delta | tar x --strip-components=1
        rm -f delta-ref.tar current.delta
    elif [ -d "$DELTA_PREFIX" ]; then
        find "$DELTA_PREFIX" -mindepth 1 -maxdepth 1 -exec mv {} . \;
        rmdir "$DELTA_PREFIX"
    fi

    # Take the MATCH and REBOOT functions from spread and allow our shell
    # scripts to use them as shell commands. The replacements are real
    # executables in tests/lib/bin (which is on PATH) but they source
    # spread-funcs.sh written here, base on the definitions provided by SPREAD.
    # This ensures that 1) spread functions define the code 2) both MATCH and
    # REBOOT are executables and not functions, and can be called from any
    # context.
    type MATCH | tail -n +2 > "$TESTSLIB"/spread-funcs.sh
    unset MATCH
    type NOMATCH | tail -n +2 >> "$TESTSLIB"/spread-funcs.sh
    unset NOMATCH
    type REBOOT | tail -n +2 >> "$TESTSLIB"/spread-funcs.sh
    unset REBOOT

    # Copy external tools from the subtree to the "$TESTSLIB"/tools directory
    # The idea is to have a single directory with all the testing tools
    cp -f "$TESTSLIB"/external/snapd-testing-tools/tools/* "$TESTSTOOLS"
    cp -f "$TESTSLIB"/external/snapd-testing-tools/remote/* "$TESTSTOOLS"

    # ensure there are no broken snaps or the invariant test will fail later
    if command -v snap; then
        BROKEN="$(snap list --all | awk '/,?broken,?/ {print $1,$3}')"
        if [ -n "$BROKEN" ]; then
            echo "Test system has broken snaps:"
            snap list --all
            exit 1
        fi
    fi

    # native jq replacement, but still with some incompatibilies, see
    # https://github.com/itchyny/gojq
    # major differences:
    # - map keys are sorted by default
    # - with --yaml-input, can parse YAML
    if os.query is-arm64; then
        "$TESTSTOOLS"/simpleget -o /tmp/gojq.tar.gz \
            https://github.com/itchyny/gojq/releases/download/v0.12.16/gojq_v0.12.16_linux_arm64.tar.gz
    elif os.query is-arm; then
        # upstream does not provide prebuilt binaries for armhf
        # built with: GOARCH=arm GOARM=7
        "$TESTSTOOLS"/simpleget -o /tmp/gojq.tar.gz \
            https://storage.googleapis.com/snapd-spread-tests/dependencies/gojq_v0.12.16_linux_armhf.tar.gz
    else
        # must be amd64
        "$TESTSTOOLS"/simpleget -o /tmp/gojq.tar.gz \
            https://github.com/itchyny/gojq/releases/download/v0.12.16/gojq_v0.12.16_linux_amd64.tar.gz
    fi

    (
        cd "$PROJECT_PATH/tests/bin"
        # only extract gojq, typically under a path:
        # -rwxr-xr-x runner/docker 4165784 2024-06-01 16:43 gojq_v0.12.16_linux_amd64/gojq
        tar -xvf /tmp/gojq.tar.gz --strip-components=1 --wildcards "*/gojq"
        test -x gojq
    )

    # NOTE: At this stage the source tree is available and no more special
    # considerations apply.
    "$TESTSLIB"/prepare-restore.sh --prepare-project
prepare-each: |
    "$TESTSLIB"/prepare-restore.sh --prepare-project-each
restore: |
    "$TESTSLIB"/prepare-restore.sh --restore-project
restore-each: |
    "$TESTSLIB"/prepare-restore.sh --restore-project-each
suites:
    tests/lib/tools/suite/:
        summary: Tests for tests/lib/tools tools
        backends: [google, qemu]
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each-minimal-no-snaps
        restore-each: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each-minimal-no-snaps
    # The essential tests designed to run inside the autopkgtest
    # environment on each platform. On autopkgtest we cannot run all tests
    # as this is very slow and we run into timeouts.
    #
    # These tests are executed on all other platforms as they
    # are designed to run on pristine systems
    tests/smoke/:
        summary: Essential system level tests for snapd
        prepare: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
        restore-each: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite
    # All other tests run now and will heavily modify the system.
    tests/main/:
        summary: Full-system tests for snapd
        systems: [-ubuntu-secboot-*, -ubuntu-fips-*]
        prepare: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
        restore-each: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite
        debug: |
            if [ "$SPREAD_DEBUG_EACH" = 1 ]; then
                systemctl status snapd.socket || true
            fi
    tests/core/:
        summary: Subset of Ubuntu Core specific tests
        systems: [ubuntu-core-*]
        prepare: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
        restore-each: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite
    tests/completion/:
        summary: completion tests
        # ppc64el disabled because of https://bugs.launchpad.net/snappy/+bug/1655594
        systems: [-ubuntu-core-*, -ubuntu-*-ppc64el, -ubuntu-secboot-*, -ubuntu-fips-*]
        prepare: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
        restore-each: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite
        environment:
            _/plain: _
            _/plain_plusdirs: _
            _/funky: _
            _/files: _
            # dirs fails on indirection because of (mis)handling of trailing
            # slashes. This might be configuration-dependent.
            # _/dirs: _
            _/hosts: _
            _/hosts_n_dirs: _
            # twisted fails in travis (but not regular spread).
            #_/twisted: _
            _/func: _
            _/funkyfunc: _
            _/funcarg: _

    tests/regression/:
        summary: Regression tests for snapd
        systems: [-ubuntu-secboot-*, -ubuntu-fips-*]
        prepare: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
        restore-each: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite

    tests/upgrade/:
        summary: Tests for snapd upgrade
        # Test cases are not yet ported to openSUSE that is why we keep
        # it disabled. A later PR will enable most tests and
        # drop the list of excluded systems.
        systems: [-ubuntu-core-*, -opensuse-*, -ubuntu-secboot-*]
        prepare-each: |
            # FIXME: this should really use prepare-restore.sh --prepare-suite-each
            # like other suites, needs more investigation

            # shellcheck source=tests/lib/state.sh
            . "$TESTSLIB"/state.sh
            mkdir -p "$RUNTIME_STATE_PATH"
            # save the job which is going to be executed in the system
            echo -n "$SPREAD_JOB " >> "$RUNTIME_STATE_PATH/runs"
        restore: |
            if [ "$REMOTE_STORE" = staging ]; then
                echo "skip upgrade tests while talking to the staging store"
                exit 0
            fi
        restore-each: |
            if [ "$REMOTE_STORE" = staging ]; then
                echo "skip upgrade tests while talking to the staging store"
                exit 0
            fi
            #shellcheck source=tests/lib/pkgdb.sh
            . "$TESTSLIB"/pkgdb.sh
            distro_purge_package snapd
            distro_purge_package snapd-xdg-open || true
    tests/cross/:
        summary: Cross-compile tests
        systems: [ubuntu-16.04-64, ubuntu-18.04-64]

    tests/unit/:
        summary: Suite to run unit tests (non-go and different go runtimes)
        # Test cases are not yet ported to Fedora/openSUSE/Arch that is why
        # we keep them disabled. A later PR will enable most tests and
        # drop the list of excluded systems.
        systems:
            [
                -ubuntu-core-*,
                -fedora-*,
                -opensuse-*,
                -arch-*,
                -amazon-*,
                -centos-*,
                -ubuntu-secboot-*,
                -ubuntu-fips-*,
            ]
        # unittests are run as part of the autopkgtest build already
        backends: [-autopkgtest]
        environment:
            # env vars required for coverage reporting from a spread task
            COVERMODE: '$(HOST: echo "$COVERMODE")'
        prepare: |
            #shellcheck source=tests/lib/prepare.sh
            . "$TESTSLIB"/prepare.sh
            prepare_classic
        prepare-each: |
            "$TESTSLIB"/reset.sh --reuse-core
            #shellcheck source=tests/lib/prepare.sh
            . "$TESTSLIB"/prepare.sh
            prepare_each_classic
        restore: |
            "$TESTSLIB"/reset.sh --store
            #shellcheck source=tests/lib/pkgdb.sh
            . "$TESTSLIB"/pkgdb.sh

            distro_purge_package snapd
            case "$SPREAD_SYSTEM" in
                arch-*)
                    # In Arch there is no separate snap-confine package.
                    ;;
                *)
                    distro_purge_package snap-confine ubuntu-core-launcher
                    ;;
            esac

    tests/nightly/:
        summary: Suite for nightly, expensive, tests
        manual: true
        # Test cases are not yet ported to Fedora/openSUSE/Arch/AMZN2 that is why
        # we keep them disabled. A later PR will enable most tests and
        # drop the list of excluded systems.
        prepare: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
        restore-each: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite

    tests/perf/main/:
        summary: Performance and Load tests
        backends: [external]
        environment:
            CONNECTIONS_PERCENTAGE: '$(HOST: echo "${PERF_CONNECTIONS_PERCENTAGE:-100}")'
            DISCONNECT_INTERFACES: '$(HOST: echo "${PERF_DISCONNECT_INTERFACES:-true}")'
            CPU_LOAD: '$(HOST: echo "${PERF_CPU_LOAD:-}")'
            LOAD_DURATION: '$(HOST: echo "${PERF_LOAD_DURATION:-1200}")'
            NUM_PARALLEL: '$(HOST: echo "${PERF_NUM_PARALLEL:-10}")'
            NUM_SNAPS: '$(HOST: echo "${PERF_NUM_SNAPS:-100}")'
        manual: true
        warn-timeout: 10m
        kill-timeout: 60m
        prepare: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
            if [ -n "$CPU_LOAD" ]; then
                # Start load generator and wait until it is active
                # It is generated as a systemd service to make it independent of snapd
                # and also to make sure it is not blocking spread scripts
                snap install --edge --devmode test-snapd-load-generator
                tests.systemd create-and-start-unit load-generator "/snap/bin/test-snapd-load-generator.run -d $LOAD_DURATION -l $CPU_LOAD"
                tests.systemd wait-for-service -n 5 --wait 1 --state active load-generator
            fi
        restore-each: |
            if [ -n "$CPU_LOAD" ]; then
                # Now we make sure all the load generator processes are killed before
                # the load-generator service is removed
                #shellcheck disable=SC2009
                PIDs="$(ps -ef | grep -e '^root.*python3.*load-generator' | awk '{print $2}')"
                # shellcheck disable=SC2086
                for pid in $PIDs; do
                    if ps -p "$pid" &>/dev/null; then 
                        kill -9 "$pid"
                    fi
                done
                tests.systemd stop-unit --remove load-generator
            fi
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite

    tests/nested/manual/:
        summary: Tests for nested images controlled manually from the tests
        backends: [google-nested, google-nested-dev, qemu-nested, google-nested-arm]
        environment:
            NESTED_TYPE: "classic"
            # Enable kvm in the qemu command line
            NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
            # Enable tpm in the nested vm in case it is supported
            NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-}")'
            # Enable secure boot in the nested vm in case it is supported
            NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-}")'
            # Add snapd debug and log to serial console
            NESTED_SNAPD_DEBUG_TO_SERIAL:  '$(HOST: echo "${NESTED_SNAPD_DEBUG_TO_SERIAL:-false}")'
            # Add any extra cmd line parameter to the nested vm
            NESTED_EXTRA_CMDLINE:  '$(HOST: echo "${NESTED_EXTRA_CMDLINE:-}")'
            # Generic image name which has to be overwritten in the test
            NESTED_IMAGE_ID: "unset"
            # Configuration file used for remote tools
            REMOTE_CFG_FILE: "$PROJECT_PATH/remote.setup.cfg"
            # Define which tests to run in the nested vm in run-spread test
            NESTED_SPREAD_TESTS:  '$(HOST: echo "${NESTED_SPREAD_TESTS:-}")'
            # Indicates that by default snapd pkg is built from current
            SNAPD_DEB_FROM_REPO: '$(HOST: echo "${SPREAD_SNAPD_DEB_FROM_REPO:-false}")'
        manual: true
        warn-timeout: 10m
        kill-timeout: 60m
        prepare: |
            #shellcheck source=tests/lib/pkgdb.sh
            . "$TESTSLIB"/pkgdb.sh
            #shellcheck source=tests/lib/image.sh
            . "$TESTSLIB"/image.sh
            #shellcheck source=tests/lib/core-initrd.sh
            . "$TESTSLIB"/core-initrd.sh
            distro_update_package_db
            distro_install_package snapd qemu-kvm qemu-utils genisoimage sshpass cloud-image-utils ovmf kpartx xz-utils mtools ca-certificates xdelta3
            if os.query is-xenial; then
                # the new ubuntu-image expects mkfs to support -d option, which was not
                # supported yet by the version of mkfs that shipped with Ubuntu 16.04
                # also ubuntu-image binary is not prebuilt for arm instances
                snap install ubuntu-image --channel="$OLD_UBUNTU_IMAGE_SNAP_CHANNEL" --classic
            elif os.query is-arm; then
                snap install ubuntu-image --channel="$UBUNTU_IMAGE_SNAP_CHANNEL" --classic
            else
               get_ubuntu_image
            fi

            if os.query is-arm; then
                export NESTED_ARCHITECTURE=arm64
            else
                export NESTED_ARCHITECTURE=amd64
            fi

            # Install the snapd built
            dpkg -i "$GOHOME"/snapd_*.deb

            # Configure the ssh connection to the test vm
            remote.setup config --host localhost --port 8022 --user user1 --pass ubuntu

            # Build and install initramfs package
            if os.query is-ubuntu-ge 24.04; then
                build_and_install_initramfs_deb
            fi
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
            tests.nested prepare
            if os.query is-xenial && ! command -v ubuntu-image >/dev/null; then
                # This is needed because the snap in removed during on restore-each
                snap install ubuntu-image --channel="$OLD_UBUNTU_IMAGE_SNAP_CHANNEL" --classic
            fi
        restore-each: |
            tests.nested vm remove
            tests.nested restore
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            #shellcheck source=tests/lib/pkgdb.sh
            . "$TESTSLIB"/pkgdb.sh
            distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils

    tests/nested/classic/:
        summary: Tests for nested images
        backends: [google-nested, google-nested-dev, qemu-nested, google-nested-arm]
        environment:
            NESTED_TYPE: "classic"
            # Channel used to create the nested vm
            NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
            # Enable tpm in the nested vm in case it is supported
            NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-false}")'
            # Enable secure boot in the nested vm in case it is supported
            NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-false}")'
            # Configuration file used for remote tools
            REMOTE_CFG_FILE: "$PROJECT_PATH/remote.setup.cfg"
            # Indicates that by default snapd pkg is built from current
            SNAPD_DEB_FROM_REPO: '$(HOST: echo "${SPREAD_SNAPD_DEB_FROM_REPO:-false}")'
        manual: true
        prepare: |
            #shellcheck source=tests/lib/pkgdb.sh
            . "$TESTSLIB"/pkgdb.sh
            #shellcheck source=tests/lib/image.sh
            . "$TESTSLIB"/image.sh
            distro_update_package_db
            distro_install_package snapd qemu-kvm qemu-utils genisoimage sshpass cloud-image-utils ovmf kpartx xz-utils mtools ca-certificates xdelta3
            if os.query is-xenial; then
                # the new ubuntu-image expects mkfs to support -d option, which was not
                # supported yet by the version of mkfs that shipped with Ubuntu 16.04
                # also ubuntu-image binary is not prebuilt for arm instances
                snap install ubuntu-image --channel="$OLD_UBUNTU_IMAGE_SNAP_CHANNEL" --classic
            elif os.query is-arm; then
                snap install ubuntu-image --channel="$UBUNTU_IMAGE_SNAP_CHANNEL" --classic
            else
                get_ubuntu_image
            fi

            if os.query is-arm; then
                export NESTED_ARCHITECTURE=arm64
            else
                export NESTED_ARCHITECTURE=amd64
            fi

            # Install the snapd built
            dpkg -i "$GOHOME"/snapd_*.deb

            # Configure the ssh connection to the test vm
            remote.setup config --host localhost --port 8022 --user user1 --pass ubuntu

            tests.nested prepare
            tests.nested build-image classic
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
            tests.nested create-vm classic
        restore-each: |
            tests.nested vm remove
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            tests.nested restore

            #shellcheck source=tests/lib/pkgdb.sh
            . "$TESTSLIB"/pkgdb.sh
            distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils

    tests/nested/core/:
        summary: Tests for nested images
        backends: [google-nested, google-nested-dev, qemu-nested, google-nested-arm]
        environment:
            NESTED_TYPE: "core"
            # Enable kvm in the qemu command line
            NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
            # Enable tpm in the nested vm in case it is supported
            NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-}")'
            # Enable secure boot in the nested vm in case it is supported
            NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-}")'
            # Add snapd debug and log to serial console
            NESTED_SNAPD_DEBUG_TO_SERIAL:  '$(HOST: echo "${NESTED_SNAPD_DEBUG_TO_SERIAL:-false}")'
            # Add any extra cmd line parameter to the nested vm
            NESTED_EXTRA_CMDLINE:  '$(HOST: echo "${NESTED_EXTRA_CMDLINE:-}")'
            # Configuration file used for remote tools
            REMOTE_CFG_FILE: "$PROJECT_PATH/remote.setup.cfg"
            # Indicates that by default snapd pkg is built from current
            SNAPD_DEB_FROM_REPO: '$(HOST: echo "${SPREAD_SNAPD_DEB_FROM_REPO:-false}")'
        manual: true
        prepare: |
            #shellcheck source=tests/lib/pkgdb.sh
            . "$TESTSLIB"/pkgdb.sh
            #shellcheck source=tests/lib/image.sh
            . "$TESTSLIB"/image.sh
            #shellcheck source=tests/lib/core-initrd.sh
            . "$TESTSLIB"/core-initrd.sh
            distro_update_package_db
            distro_install_package snapd qemu-kvm qemu-utils genisoimage sshpass cloud-image-utils ovmf kpartx xz-utils mtools ca-certificates xdelta3
            if os.query is-xenial; then
                # the new ubuntu-image expects mkfs to support -d option, which was not
                # supported yet by the version of mkfs that shipped with Ubuntu 16.04
                # also ubuntu-image binary is not prebuilt for arm instances
                snap install ubuntu-image --channel="$OLD_UBUNTU_IMAGE_SNAP_CHANNEL" --classic
            elif os.query is-arm; then
                snap install ubuntu-image --channel="$UBUNTU_IMAGE_SNAP_CHANNEL" --classic
            else
                get_ubuntu_image
            fi

            # Install the snapd built
            dpkg -i "$GOHOME"/snapd_*.deb

            # Configure the ssh connection to the test vm
            remote.setup config --host localhost --port 8022 --user user1 --pass ubuntu

            # Build and install initramfs package
            if os.query is-ubuntu-ge 24.04; then
                build_and_install_initramfs_deb
            fi

            tests.nested prepare
            tests.nested build-image core
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
            tests.nested create-vm core
        restore-each: |
            tests.nested vm remove
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            tests.nested restore

            #shellcheck source=tests/lib/pkgdb.sh
            . "$TESTSLIB"/pkgdb.sh
            distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils

    tests/perf/nested/:
        summary: Performance and Load tests preparation suite
        backends: [google-nested, google-nested-dev, qemu-nested]
        environment:
            NESTED_TYPE: "core"
            # Enable kvm in the qemu command line
            NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
            # Enable tpm in the nested vm in case it is supported
            NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-true}")'
            # Enable secure boot in the nested vm in case it is supported
            NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-true}")'
            # Add snapd debug and log to serial console
            NESTED_SNAPD_DEBUG_TO_SERIAL: '$(HOST: echo "${NESTED_SNAPD_DEBUG_TO_SERIAL:-false}")'
            # Add any extra cmd line parameter to the nested vm
            NESTED_EXTRA_CMDLINE: '$(HOST: echo "${NESTED_EXTRA_CMDLINE:-}")'
            # Configuration file used for remote tools
            REMOTE_CFG_FILE: "$PROJECT_PATH/remote.setup.cfg"
            # Indicates the number of cpus to use in the nested vm
            NESTED_CPUS: '$(HOST: echo "${NESTED_CPUS:-2}")'
            # Indicates the amount of memory in MB to use in the nested vm
            NESTED_MEM: '$(HOST: echo "${NESTED_MEM:-4096}")'
            SPREAD_URL: https://storage.googleapis.com/snapd-spread-tests/spread/spread-amd64.tar.gz
            # Indicates that by default snapd pkg is built from current
            SNAPD_DEB_FROM_REPO: '$(HOST: echo "${SPREAD_SNAPD_DEB_FROM_REPO:-false}")'
        manual: true
        warn-timeout: 10m
        kill-timeout: 60m
        prepare: |
            #shellcheck source=tests/lib/pkgdb.sh
            . "$TESTSLIB"/pkgdb.sh
            #shellcheck source=tests/lib/image.sh
            . "$TESTSLIB"/image.sh
            distro_update_package_db
            distro_install_package snapd qemu-kvm qemu-utils genisoimage sshpass cloud-image-utils ovmf kpartx xz-utils mtools ca-certificates xdelta3
            if os.query is-xenial; then
                # the new ubuntu-image expects mkfs to support -d option, which was not
                # supported yet by the version of mkfs that shipped with Ubuntu 16.04
                # also ubuntu-image binary is not prebuilt for arm instances
                snap install ubuntu-image --channel="$OLD_UBUNTU_IMAGE_SNAP_CHANNEL" --classic
            elif os.query is-arm; then
                snap install ubuntu-image --channel="$UBUNTU_IMAGE_SNAP_CHANNEL" --classic
            else
                get_ubuntu_image
            fi
  
            # Install the snapd built
            dpkg -i "$GOHOME"/snapd_*.deb

            # Configure the ssh connection to the test vm
            remote.setup config --host localhost --port 8022 --user user1 --pass ubuntu

            tests.nested prepare
            tests.nested build-image core
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
            tests.nested create-vm core --param-cpus "$NESTED_CPUS" --param-mem "$NESTED_MEM"

        restore-each: |
            tests.nested vm remove
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each

        restore: |
            tests.nested restore

            #shellcheck source=tests/lib/pkgdb.sh
            . "$TESTSLIB"/pkgdb.sh
            distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils

    # FIPS test suite
    tests/fips/:
        summary: FIPS enabled test suite
        systems:
          - ubuntu-fips-*
        environment:
          # disable reexec so that the tests run with deb
          SNAP_REEXEC/deb: "0"
          # but keep it enabled when using the snap
          SNAP_REEXEC/snap: "1"
        prepare: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite
        prepare-each: |
            "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
            # When snapd.deb is from the repo, we just need to test when re-exec is enabled
            if [ "$SNAP_REEXEC" = "0" ] && tests.info is-snapd-from-archive; then
                tests.exec skip-test "When snapd.deb is from the repo, we just need to test when re-exec is enabled" && exit 0
            fi
        restore-each: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite-each
        restore: |
            "$TESTSLIB"/prepare-restore.sh --restore-suite
        debug: |
            if [ "$SPREAD_DEBUG_EACH" = 1 ]; then
                systemctl status snapd.socket || true
            fi

# vim:ts=4:sw=4:et