|
| 1 | +from ngci import TestSuite, SelftestsBuild, SelftestsConfig, QemuSelftestsConfig, TestConfig, QemuNetTestConfig |
| 2 | +from configs import * |
| 3 | +from defaults import * |
| 4 | +from qemu import kvm_present |
| 5 | + |
| 6 | + |
| 7 | +def std_images(args): |
| 8 | + if args.images: |
| 9 | + return args.images |
| 10 | + |
| 11 | + return DEFAULT_IMAGES |
| 12 | + |
| 13 | + |
| 14 | +def sparse_image(images): |
| 15 | + for image in images: |
| 16 | + if image in SPARSE_IMAGES: |
| 17 | + return image |
| 18 | + return None |
| 19 | + |
| 20 | + |
| 21 | +def clang_image(images): |
| 22 | + for image in images: |
| 23 | + if image in CLANG_IMAGES: |
| 24 | + return image |
| 25 | + return None |
| 26 | + |
| 27 | + |
| 28 | +def qemu_coverage(args, suite=None): |
| 29 | + images = std_images(args) |
| 30 | + if suite is None: |
| 31 | + suite = TestSuite('qemu-coverage', qemus=args.qemus) |
| 32 | + |
| 33 | + k = suite.add_kernel |
| 34 | + b = suite.add_qemu_boot |
| 35 | + |
| 36 | + have_kvm = kvm_present() |
| 37 | + if have_kvm: |
| 38 | + accel = 'kvm' |
| 39 | + else: |
| 40 | + accel = 'tcg' |
| 41 | + |
| 42 | + image = clang_image(images) |
| 43 | + # Clang builds & boots |
| 44 | + if image: |
| 45 | + k('ppc64le_guest_defconfig+clang', image, merge_config=guest_configs, clang=True) |
| 46 | + k('ppc64_guest_defconfig+clang', image, merge_config=guest_configs, clang=True) |
| 47 | + k('corenet64_smp_defconfig+clang', image, merge_config=corenet64_configs + ['disable-werror'], clang=True) |
| 48 | + k('corenet32_smp_defconfig+clang', image, merge_config=['debug-info-n', 'ppc64e-qemu', 'disable-werror'], clang=True) |
| 49 | + k('pmac32_defconfig+clang', image, merge_config=pmac32_configs + ['disable-werror'], clang=True) |
| 50 | + k('g5_defconfig+clang', image, merge_config=g5_configs + ['disable-werror'], clang=True) |
| 51 | + |
| 52 | + b('qemu-mac99', 'pmac32_defconfig+clang', image) |
| 53 | + b('qemu-g5', 'g5_defconfig+clang', image) |
| 54 | + # Doesn't boot |
| 55 | + # b('qemu-e500mc', 'corenet32_smp_defconfig+clang', image) |
| 56 | + b('qemu-ppc64e', 'corenet64_smp_defconfig+clang', image) |
| 57 | + b('qemu-pseries+p10+tcg', 'ppc64le_guest_defconfig+clang', image) |
| 58 | + b('qemu-powernv+p10+tcg', 'ppc64le_guest_defconfig+clang', image) |
| 59 | + |
| 60 | + b(f'qemu-pseries+p8+{accel}', 'ppc64le_guest_defconfig+clang', image) |
| 61 | + b(f'qemu-pseries+p9+{accel}', 'ppc64le_guest_defconfig+clang', image) |
| 62 | + b(f'qemu-pseries+p8+{accel}', 'ppc64_guest_defconfig+clang', image) |
| 63 | + b(f'qemu-pseries+p9+{accel}', 'ppc64_guest_defconfig+clang', image) |
| 64 | + |
| 65 | + # GCC builds & boots |
| 66 | + for image in images: |
| 67 | + # BOOK3S64 && LITTLE_ENDIAN, PSERIES and POWERNV |
| 68 | + k('ppc64le_guest_defconfig+lockdep', image, merge_config=guest_configs + ['lockdep-y']) |
| 69 | + # BOOK3S64 && BIG_ENDIAN |
| 70 | + # PSERIES, POWERNV, CELL, PS3, PMAC && PMAC64, PASEMI, MAPLE |
| 71 | + k('ppc64_guest_defconfig+lockdep', image, merge_config=guest_configs + ['lockdep-y']) |
| 72 | + # As above with 4K page size |
| 73 | + k('ppc64le_guest_defconfig+4k', image, merge_config=guest_configs_4k) |
| 74 | + k('ppc64_guest_defconfig+4k', image, merge_config=guest_configs_4k) |
| 75 | + # G5 |
| 76 | + k('g5_defconfig', image, merge_config=g5_configs) |
| 77 | + # BOOK3E_64 |
| 78 | + k('corenet64_smp_defconfig', image, merge_config=corenet64_configs) |
| 79 | + k('corenet64_smp_defconfig+e6500', image, merge_config=corenet64_configs + ['e6500-y', 'altivec-y']) |
| 80 | + # PPC_BOOK3S_32 |
| 81 | + k('pmac32_defconfig', image, merge_config=pmac32_configs) |
| 82 | + # 44x |
| 83 | + k('ppc44x_defconfig', image, merge_config=['devtmpfs']) |
| 84 | + # 8xx |
| 85 | + k('mpc885_ads_defconfig', image) |
| 86 | + |
| 87 | + # PPC_85xx |
| 88 | + |
| 89 | + k('corenet32_smp_defconfig', image, merge_config=['debug-info-n']) |
| 90 | + b('qemu-e500mc', 'corenet32_smp_defconfig', image) |
| 91 | + |
| 92 | + # PPC_BOOK3S_32 |
| 93 | + b('qemu-mac99', 'pmac32_defconfig', image) |
| 94 | + b('qemu-mac99+debian', 'pmac32_defconfig', image) |
| 95 | + # 44x |
| 96 | + b('qemu-44x', 'ppc44x_defconfig', image) |
| 97 | + # ppc64e |
| 98 | + b('qemu-ppc64e', 'corenet64_smp_defconfig', image) |
| 99 | + b('qemu-ppc64e+compat', 'corenet64_smp_defconfig', image) |
| 100 | + b('qemu-e6500', 'corenet64_smp_defconfig+e6500', image) |
| 101 | + b('qemu-e6500+debian', 'corenet64_smp_defconfig+e6500', image) |
| 102 | + # G5 |
| 103 | + b('qemu-g5', 'g5_defconfig', image) |
| 104 | + b('qemu-g5+compat', 'g5_defconfig', image) |
| 105 | + # pseries boots |
| 106 | + b('qemu-pseries+p10+tcg', 'ppc64le_guest_defconfig+lockdep', image) |
| 107 | + b('qemu-pseries+p10+tcg', 'ppc64_guest_defconfig+lockdep', image) |
| 108 | + |
| 109 | + b(f'qemu-pseries+p8+{accel}', 'ppc64le_guest_defconfig+lockdep', image) |
| 110 | + b(f'qemu-pseries+p9+{accel}', 'ppc64le_guest_defconfig+lockdep', image) |
| 111 | + b(f'qemu-pseries+p8+{accel}', 'ppc64_guest_defconfig+lockdep', image) |
| 112 | + b(f'qemu-pseries+p9+{accel}', 'ppc64_guest_defconfig+lockdep', image) |
| 113 | + b(f'qemu-pseries+p9+{accel}+fedora39', 'ppc64le_guest_defconfig+lockdep', image) |
| 114 | + # powernv boots |
| 115 | + b('qemu-powernv+p8+tcg', 'ppc64le_guest_defconfig+lockdep', image) |
| 116 | + b('qemu-powernv+p9+tcg', 'ppc64le_guest_defconfig+lockdep', image) |
| 117 | + b('qemu-powernv+p10+tcg', 'ppc64le_guest_defconfig+lockdep', image) |
| 118 | + b('qemu-powernv+p8+tcg', 'ppc64_guest_defconfig+lockdep', image) |
| 119 | + b('qemu-powernv+p9+tcg', 'ppc64_guest_defconfig+lockdep', image) |
| 120 | + b('qemu-powernv+p10+tcg', 'ppc64_guest_defconfig+lockdep', image) |
| 121 | + |
| 122 | + |
| 123 | + for image in [ '[email protected]', 'ubuntu']: |
| 124 | + suite.add_selftest(image, 'ppc64le') |
| 125 | + suite.add_selftest(image, 'ppc64le', 'ppctests') |
| 126 | + |
| 127 | + return suite |
| 128 | + |
| 129 | + |
| 130 | +def full_compile_test(args, suite=None): |
| 131 | + images = std_images(args) |
| 132 | + if suite is None: |
| 133 | + suite = TestSuite('full-compile-test') |
| 134 | + |
| 135 | + k = suite.add_kernel |
| 136 | + |
| 137 | + ######################################### |
| 138 | + # Clang builds |
| 139 | + ######################################### |
| 140 | + image = clang_image(images) |
| 141 | + if image: |
| 142 | + k('ppc64le_guest_defconfig+clang', image, merge_config=guest_configs, clang=True) |
| 143 | + k('ppc64le_guest_defconfig+clang+ias', image, merge_config=guest_configs, clang=True, llvm_ias=True) |
| 144 | + k('ppc64_guest_defconfig+clang', image, merge_config=guest_configs, clang=True) |
| 145 | + k('corenet64_smp_defconfig+clang', image, merge_config=corenet64_configs + ['disable-werror'], clang=True) |
| 146 | + k('corenet32_smp_defconfig+clang', image, merge_config=['debug-info-n', 'ppc64e-qemu', 'disable-werror'], clang=True) |
| 147 | + k('pmac32_defconfig+clang', image, merge_config=pmac32_configs + ['disable-werror'], clang=True) |
| 148 | + k('g5_defconfig+clang', image, merge_config=g5_configs + ['disable-werror'], clang=True) |
| 149 | + k('mpc885_ads_defconfig+clang', image, clang=True) |
| 150 | + k('ppc44x_defconfig+clang', image, clang=True) |
| 151 | + |
| 152 | + ######################################### |
| 153 | + # Sparse builds |
| 154 | + ######################################### |
| 155 | + image = sparse_image(images) |
| 156 | + if image: |
| 157 | + k('ppc64le_defconfig+sparse', image, sparse=True) |
| 158 | + k('ppc64_defconfig+sparse', image, sparse=True) |
| 159 | + k('pmac32_defconfig+sparse', image, sparse=True) |
| 160 | + |
| 161 | + # MICROWATT, also VSX=n, doesn't build with GCC 5.5.0 |
| 162 | + k('microwatt_defconfig', 'fedora') |
| 163 | + |
| 164 | + # GCC builds & boots |
| 165 | + for image in images: |
| 166 | + ######################################### |
| 167 | + # Major platforms coverage |
| 168 | + ######################################### |
| 169 | + # BOOK3S64 && LITTLE_ENDIAN, PSERIES and POWERNV |
| 170 | + k('ppc64le_guest_defconfig', image, merge_config=guest_configs) |
| 171 | + # BOOK3S64 && BIG_ENDIAN |
| 172 | + # PSERIES, POWERNV, CELL, PS3, PMAC && PMAC64, PASEMI, MAPLE |
| 173 | + k('ppc64_guest_defconfig', image, merge_config=guest_configs) |
| 174 | + # As above with 4K page size |
| 175 | + k('ppc64le_guest_defconfig+4k', image, merge_config=guest_configs_4k) |
| 176 | + k('ppc64_guest_defconfig+4k', image, merge_config=guest_configs_4k) |
| 177 | + # PMAC && PMAC64 |
| 178 | + k('g5_defconfig', image, merge_config=g5_configs) |
| 179 | + # BOOK3E_64 |
| 180 | + k('corenet64_smp_defconfig', image, merge_config=corenet64_configs) |
| 181 | + # PPC_85xx, PPC_E500MC |
| 182 | + k('corenet32_smp_defconfig', image, merge_config=['debug-info-n']) |
| 183 | + # PPC_85xx, SMP=y, PPC_E500MC=n |
| 184 | + k('mpc85xx_smp_defconfig', image) |
| 185 | + # PPC_85xx, SMP=n |
| 186 | + k('mpc85xx_defconfig', image) |
| 187 | + # PPC_BOOK3S_32 |
| 188 | + k('pmac32_defconfig', image, merge_config=pmac32_configs) |
| 189 | + k('pmac32_defconfig+smp', image, merge_config=pmac32_configs + ['smp-y']) |
| 190 | + # 44x |
| 191 | + k('ppc44x_defconfig', image, merge_config=['devtmpfs']) |
| 192 | + # 8xx |
| 193 | + k('mpc885_ads_defconfig', image) |
| 194 | + |
| 195 | + ######################################### |
| 196 | + # allyes/no/mod |
| 197 | + ######################################### |
| 198 | + if image.startswith('korg@'): |
| 199 | + no_gcc_plugins = ['gcc-plugins-n'] |
| 200 | + else: |
| 201 | + no_gcc_plugins = [] |
| 202 | + |
| 203 | + # 32-bit Book3S BE |
| 204 | + k('allnoconfig', image) |
| 205 | + # 64-bit Book3S LE |
| 206 | + # Doesn't exist |
| 207 | + #k('ppc64le_allyesconfig', image) |
| 208 | + |
| 209 | + # GCC 5.5.0 fails on various things for allyes/allmod |
| 210 | + |
| 211 | + # 64-bit Book3S BE |
| 212 | + k('allyesconfig', tmp_image, merge_config=no_gcc_plugins) |
| 213 | + # 64-bit Book3S BE |
| 214 | + k('allmodconfig', tmp_image, merge_config=no_gcc_plugins) |
| 215 | + # 64-bit Book3S LE |
| 216 | + k('ppc64le_allmodconfig', tmp_image, merge_config=no_gcc_plugins) |
| 217 | + # 32-bit Book3S BE (korg 5.5.0 doesn't build) |
| 218 | + k('ppc32_allmodconfig', tmp_image, merge_config=no_gcc_plugins) |
| 219 | + # 64-bit BOOK3E BE (korg 5.5.0 doesn't build) |
| 220 | + # FIXME Broken due to start_text_address problems |
| 221 | + # k('ppc64_book3e_allmodconfig', tmp_image, merge_config=no_gcc_plugins) |
| 222 | + |
| 223 | + ######################################### |
| 224 | + # specific machine/platform configs |
| 225 | + ######################################### |
| 226 | + # PSERIES (BE) |
| 227 | + k('pseries_defconfig', image), |
| 228 | + # PSERIES (LE) |
| 229 | + k('pseries_le_defconfig', image), |
| 230 | + # Options for old LPARs |
| 231 | + k('ppc64le_guest_defconfig+legacy', image, merge_config=legacy_guest_configs) |
| 232 | + # POWERNV |
| 233 | + cfgs = powernv_configs |
| 234 | + |
| 235 | + # BTF causes build errors with 5.5.0, disable it |
| 236 | + cfgs.append('btf-n') |
| 237 | + k('powernv_defconfig', image, merge_config=cfgs) |
| 238 | + # CELL |
| 239 | + k('cell_defconfig', image, merge_config=cell_configs) |
| 240 | + # POWERNV, some shrinking/hardening options |
| 241 | + k('skiroot_defconfig', image) |
| 242 | + # PPC_86xx (BOOK3S_32) |
| 243 | + k('mpc86xx_smp_defconfig', image) |
| 244 | + |
| 245 | + ######################################### |
| 246 | + # specific features |
| 247 | + ######################################### |
| 248 | + # PPC_8xx + PPC16K_PAGES |
| 249 | + k('mpc885_ads_defconfig+16k', image, merge_config=['16k-pages']) |
| 250 | + |
| 251 | + ######################################### |
| 252 | + # specific enabled features |
| 253 | + ######################################### |
| 254 | + for feature in ['preempt', 'compat', 'lockdep', 'reltest']: |
| 255 | + k(f'ppc64_defconfig+{feature}', image, merge_config=[f'{feature}-y']) |
| 256 | + k(f'ppc64le_defconfig+{feature}', image, merge_config=[f'{feature}-y']) |
| 257 | + |
| 258 | + ######################################### |
| 259 | + # specific disabled features |
| 260 | + ######################################### |
| 261 | + for feature in ['radix', 'modules']: |
| 262 | + k(f'ppc64_defconfig+no{feature}', image, merge_config=[f'{feature}-n']) |
| 263 | + k(f'ppc64le_defconfig+no{feature}', image, merge_config=[f'{feature}-n']) |
| 264 | + |
| 265 | + # PPC_85xx + RANDOMIZE_BASE |
| 266 | + # This hits gcc segfaults with earlier compilers, so use 8.5.0 |
| 267 | + k( 'mpc85xx_smp_defconfig+kaslr', image. replace( '[email protected]', '[email protected]'), merge_config=[ 'randomize-base-y']) |
| 268 | + |
| 269 | + ######################################### |
| 270 | + # selftests |
| 271 | + ######################################### |
| 272 | + for version in ['16.04', '18.04', '20.04', '22.04', '22.10']: |
| 273 | + image = f'ubuntu@{version}' |
| 274 | + for subarch in ['ppc64', 'ppc64le']: |
| 275 | + suite.add_selftest(image, subarch, 'selftests') |
| 276 | + suite.add_selftest(image, subarch, 'ppctests') |
| 277 | + |
| 278 | + return suite |
| 279 | + |
| 280 | + |
| 281 | +def full_compile_and_qemu(args): |
| 282 | + suite = TestSuite('full-compile-and-qemu', qemus=args.qemus) |
| 283 | + full_compile_test(args, suite) |
| 284 | + qemu_coverage(args, suite) |
| 285 | + return suite |
0 commit comments