Android testing is broken with swiftbuild

Aperta
#277 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
android, github-actions, shell, swift
Ambito
ci-cd, mobile, testing

Direzione di ricerca

Inizia da .github/workflows/scripts/android/android-emulator-tests.sh alle righe collegate e verifica come viene selezionabile ed eseguito l'eseguibile dei test Android. Confronta l'output di swiftbuild in .build/out/Products/Debug-android con il layout nativo, inclusi i modi XCTest e Swift Testing. È completato quando ogni runner della destinazione di test viene eseguito e il workflow fallisce quando un singolo risultato non ha esito positivo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

In https://github.com/swiftlang/github-workflows/pull/269, the Android build script dropped the --build-system native flag, so we will use whatever the default is for the current toolchain (which, as of 6.4, is 'swiftbuild'). That PR rightly handles the fact that the native build created test executables with the .xctest suffix, but the new swiftbuild created the binaries ending with -test-runner (as discussed at https://github.com/swiftlang/swift-package-manager/issues/9673):

https://github.com/swiftlang/github-workflows/blob/0366eba41655706c5a306fbc0f798eb2ad6aa3e3/.github/workflows/scripts/android/android-emulator-tests.sh#L163-L175

However, it doesn't take into account the fact that while native created a single monolithic test executable, swiftbuild appears to create a separate executable for each test target (@owenv confirm?)

For example, for the swift-numerics package:

native: .build/aarch64-unknown-linux-android28/debug/swift-numericsPackageTests.xctest
swiftbuild: .build/out/Products/Debug-android/ComplexTests-test-runner, .build/out/Products/Debug-android/RealTests-test-runner, .build/out/Products/Debug-android/IntegerUtilitiesTests-test-runner

This means that even if the test is being executed at all, it is likely only executing one of them. This may explain why swift-algorithms testing is passing with 6.3 Android, but failing with nightly-main Android.

Unless there is some hidden way to run all the tests as a single batch, I suspect that we'll need to have the action create a little script that executes each of the test executables, remembers the process result for each of them, and then passes/fails based on whether all of the individual tests passed. Something like:

# Run each of the test binaries, both in XCTest mode and Swift Testing mode
.build/out/Products/Debug-android/ComplexTests-test-runner; echo $? >> results.txt
.build/out/Products/Debug-android/ComplexTests-test-runner --testing-library xctest; echo $? >> results.txt

.build/out/Products/Debug-android/RealTests-test-runner; echo $? >> results.txt
.build/out/Products/Debug-android/RealTests-test-runner --testing-library xctest; echo $? >> results.txt

.build/out/Products/Debug-android/IntegerUtilitiesTests-test-runner; echo $? >> results.txt
.build/out/Products/Debug-android/IntegerUtilitiesTests-test-runner --testing-library xctest; echo $? >> results.txt

# grep for any non-0 non-69 values in results.txt and fail if any are found…

CC @swiftlang/android-workgroup as discussed at the workgroup meeting today
CC @dschaefer in case this is of interest for packaging and tooling (https://github.com/swiftlang/swift-package-manager/issues/9940#issuecomment-4361950153)

Lingua principale
Swift
Stelle
115
Fork
57
Merge medio
1g 8h
PR unite (30g)
3

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di swiftlang/github-workflows

Tutte le issue di swiftlang/github-workflows

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.