swiftlang/swift

[SR-1835] test/Interpreter/SDK/libc.swift fails on Android

開放

#44,444 建立於 2016年6月20日

 (1 則留言) (0 個反應) (0 位負責人)Swift (10,719 個分叉)batch import
Androidbuggood first issuestandard library

倉庫指標

星標
 (69,989 顆星)
PR 合併指標
 (平均合併 8天 17小時) (30 天內合併 510 個 PR)

描述

Previous ID SR-1835
Radar None
Original Reporter @modocache
Type Bug
Votes 0
Component/s Standard Library
Labels Bug, Android, StarterBug
Assignee None
Priority Medium

md5: 0255bc27175dbbaf4288ecf685de7131

Issue Description:

It appears as if the reference to stdout is causing a compilation failure:

********************
FAIL: Swift :: Interpreter/SDK/libc.swift (1126 of 8325)
******************** TEST 'Swift :: Interpreter/SDK/libc.swift' FAILED ********************
Script:
--
rm -rf /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp  &&  mkdir -p /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp
rm -rf /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp && mkdir -p /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp && /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc -target armv7-none-linux-androideabi -sdk /home/modocache/android-ndk-r11c/platforms/android-21/arch-arm -L /home/modocache/android-ndk-r11c/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -L /home/modocache/android-ndk-r11c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9 -Xlinker -pie  -module-cache-path '/tmp/swift-testsuite-clang-module-cachesARjF4'   -module-cache-path '/tmp/swift-testsuite-clang-module-cachesARjF4' /home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift -o /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp/a.out -module-name main && /home/modocache/GitHub/apple/swift/utils/android/adb_test_runner.py /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp/a.out /home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift /home/modocache/GitHub/apple/build/Ninja-ReleaseAssert/swift-linux-x86_64/test-android-armv7/Interpreter/SDK/Output/libc.swift.tmp | FileCheck /home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift
--
Exit Code: 1

Command Output (stderr):
--
/home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift:18:22: error: use of unresolved identifier 'stdout'
fputs("Hello world", stdout)
                     ^~~~~~
SwiftGlibc.strtoul:1:13: note: did you mean 'strtoul'?
public func strtoul(_: UnsafePointer<Int8>!, _: UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>!, _: Int32) -> UInt
            ^
/home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift:54:26: error: binary operator '==' cannot be applied to operands of type 'UInt32' and 'UInt16'
  assert(statbuf.st_mode == S_IFREG | S_IRUSR | S_IWUSR | S_IXUSR)
         ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/modocache/GitHub/apple/swift/test/Interpreter/SDK/libc.swift:54:26: note: overloads for '==' exist with these partially matching parameter lists: (UInt16, UInt16), (UInt32, UInt32)
  assert(statbuf.st_mode == S_IFREG | S_IRUSR | S_IWUSR | S_IXUSR)

stdout should be defined on Android, though. My guess is that it should be defined in stdlib/public/Platform/Platform.swift or it should be imported from Android's libc, Bionic.

Prerequisites:

  • An Ubuntu 15.10 development environment capable of building Swift from source.

  • A physical Android device.

Helpful skills:
Familiarity with Swift, ClangImporter, and the Android libc would all be helpful, but certainly not required. The most helpful skill here is probably patience as you compile and run the tests again and again. 🙂

Starting point:
Follow the instructions in docs/Android.md to build and run the test suite on a physical Android device. Confirm this test still fails.

貢獻者指南