(t *testing.T, archivePath string, disableRecursion bool)
| 77 | } |
| 78 | |
| 79 | func runExtraction(t *testing.T, archivePath string, disableRecursion bool) *xtractr.Response { |
| 80 | t.Helper() |
| 81 | |
| 82 | cfg := &FolderConfig{DisableRecursion: disableRecursion, ExtractISOs: false} |
| 83 | exclude := folderExcludeSuffixes(archivePath, cfg) |
| 84 | |
| 85 | queue := xtractr.NewQueue(&xtractr.Config{ |
| 86 | Parallel: 1, |
| 87 | Suffix: suffix, |
| 88 | FileMode: defaultFileMode, |
| 89 | DirMode: defaultDirMode, |
| 90 | }) |
| 91 | |
| 92 | t.Cleanup(func() { queue.Stop() }) |
| 93 | |
| 94 | callbacks := make(chan *xtractr.Response, updateChanBuf) |
| 95 | |
| 96 | _, err := queue.Extract(&xtractr.Xtract{ |
| 97 | Name: archivePath, |
| 98 | Filter: xtractr.Filter{Path: archivePath, ExcludeSuffix: exclude}, |
| 99 | TempFolder: true, |
| 100 | DeleteOrig: false, |
| 101 | CBChannel: callbacks, |
| 102 | DisableRecursion: disableRecursion, |
| 103 | LogFile: false, |
| 104 | }) |
| 105 | if err != nil { |
| 106 | t.Fatalf("queue.Extract returned error: %v", err) |
| 107 | } |
| 108 | |
| 109 | timeout := time.NewTimer(90 * time.Second) |
| 110 | defer timeout.Stop() |
| 111 | |
| 112 | for { |
| 113 | select { |
| 114 | case resp := <-callbacks: |
| 115 | if resp.Done { |
| 116 | return resp |
| 117 | } |
| 118 | case <-timeout.C: |
| 119 | t.Fatal("timed out waiting for folder extraction callback") |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | func makeNestedZipFixture(t *testing.T) string { |
| 125 | t.Helper() |
no test coverage detected