Since you are running on a M1 Mac I think the reason for why it is failing is because test is hard coded to target x86_64 for example // RUN: %target-swift-api-extract -target x86_64-apple-macos11.0 -o - -pretty-print %t/MyModule.swiftinterface -module-name MyModule -module-cache-path %t | %FileCheck %s. So test will try to find an link against a x86_64 stdlib and fail.
We could test locally a couple of options:
Since this seems not to be a target specific test, replacing all -target x86_64-apple-macos11.0 with -target %target-cpu-apple-macos11.0.
Only run this test on x86_64 by adding a // REQUIRES: CPU=x86_64