Download this file
| 1 | package headless |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "os" |
| 6 | "strings" |
| 7 | "time" |
| 8 | ) |
| 9 | |
| 10 | // fakeXcodebuild is the fake worker's xcodebuild (a copy of this test |
| 11 | // binary named xcodebuild): it fails while Woodstar/Swipe.swift or |
| 12 | // Pane.swift says false, printing the edit that fixes it, passes |
| 13 | // otherwise, and hangs while a file named like it with ".hang" exists. |
| 14 | func fakeXcodebuild() int { |
| 15 | self, _ := os.Executable() |
| 16 | if _, err := os.Stat(self + ".hang"); err == nil { |
| 17 | fmt.Println("Testing started") |
| 18 | time.Sleep(time.Hour) |
| 19 | return 1 |
| 20 | } |
| 21 | fmt.Println("Test Suite 'All tests' started") |
| 22 | for _, c := range [][2]string{{"Woodstar/Swipe.swift", "edgeSwipe"}, {"Woodstar/Pane.swift", "paneBack"}} { |
| 23 | src, _ := os.ReadFile(c[0]) |
| 24 | if strings.Contains(string(src), c[1]+" = false") { |
| 25 | fmt.Printf("%s:1: error: XCTAssertTrue failed: %s is false. edit:%s|%s = false|%s = true\n", c[0], c[1], c[0], c[1], c[1]) |
| 26 | if c[1] == "paneBack" { |
| 27 | // The fix round says where it works and whether the |
| 28 | // first round's uncommitted file is there (M9b). |
| 29 | fmt.Println("note: probe:build/leftover.txt saycwd") |
| 30 | } |
| 31 | fmt.Println("** TEST FAILED **") |
| 32 | return 65 |
| 33 | } |
| 34 | } |
| 35 | fmt.Println("Test Suite 'All tests' passed.\n** TEST SUCCEEDED **") |
| 36 | return 0 |
| 37 | } |
| 38 | |