   let res2 = sem_unlink(semaphoreName)
   expectEqual(0, res2)
 }
+#endif
 
 // Fail because the semaphore already exists.
+#if !os(Android) // Android doesn’t implement sem_open and always return ENOSYS
 POSIXTests.test("sem_open existing O_EXCL fail") {
   let sem = sem_open(semaphoreName, O_CREAT, 0o777, 1)
   expectNotEqual(SEM_FAILED, sem)

var POSIXTests = TestSuite("POSIXTests")

let semaphoreName = "TestSem"
let fn = "test.txt"

POSIXTests.setUp {
  sem_unlink(semaphoreName)

}

// Failed semaphore creation.
#if !os(Android) // Android doesn’t implement sem_open and always return ENOSYS
POSIXTests.test("sem_open fail") {
  let sem = sem_open(semaphoreName, 0)
  expectEqual(SEM_FAILED, sem)
  expectEqual(ENOENT, errno)
}
#endif

// Successful semaphore creation.
#if !os(Android) // Android doesn’t implement sem_open and always return ENOSYS
POSIXTests.test("sem_open success") {
  let sem = sem_open(semaphoreName, O_CREAT, 0o777, 1)
  expectNotEqual(SEM_FAILED, sem)
