|
43 | 43 | import org.opensolaris.opengrok.history.Repository;
|
44 | 44 | import org.opensolaris.opengrok.history.RepositoryFactory;
|
45 | 45 | import org.opensolaris.opengrok.history.RepositoryInfo;
|
| 46 | +import org.opensolaris.opengrok.util.Executor; |
46 | 47 | import org.opensolaris.opengrok.util.FileUtilities;
|
47 | 48 | import org.opensolaris.opengrok.util.TestRepository;
|
48 | 49 | import static org.junit.Assert.*;
|
@@ -204,4 +205,46 @@ public void testBug3430() throws Exception {
|
204 | 205 | System.out.println("Skipping test. Could not find a ctags I could use in path.");
|
205 | 206 | }
|
206 | 207 | }
|
| 208 | + |
| 209 | + @Test |
| 210 | + public void testBug11896() throws Exception { |
| 211 | + |
| 212 | + boolean test = true; |
| 213 | + Executor executor = new Executor(new String[] {"mkfifo"}); |
| 214 | + |
| 215 | + executor.exec(true); |
| 216 | + String output = executor.getErrorString(); |
| 217 | + if (output == null || output.indexOf("mkfifo") == -1 || output.indexOf("command not found") > -1) { |
| 218 | + System.out.println("Error: No mkfifo found in PATH!\n"); |
| 219 | + test = false; |
| 220 | + } |
| 221 | + |
| 222 | + if (test) { |
| 223 | + RuntimeEnvironment env = RuntimeEnvironment.getInstance(); |
| 224 | + env.setSourceRoot(repository.getSourceRoot()); |
| 225 | + env.setDataRoot(repository.getDataRoot()); |
| 226 | + |
| 227 | + executor = new Executor(new String[] {"mkdir", "-p", repository.getSourceRoot()+"/testBug11896"}); |
| 228 | + executor.exec(true); |
| 229 | + |
| 230 | + executor = new Executor(new String[] {"mkfifo", repository.getSourceRoot()+"/testBug11896/FIFO"}); |
| 231 | + executor.exec(true); |
| 232 | + |
| 233 | + if (env.validateExuberantCtags()) { |
| 234 | + Project project = new Project(); |
| 235 | + project.setPath("/testBug11896"); |
| 236 | + IndexDatabase idb = new IndexDatabase(project); |
| 237 | + assertNotNull(idb); |
| 238 | + MyIndexChangeListener listener = new MyIndexChangeListener(); |
| 239 | + idb.addIndexChangedListener(listener); |
| 240 | + System.out.println("Trying to index a special file - FIFO in this case."); |
| 241 | + idb.update(); |
| 242 | + assertEquals(0, listener.files.size()); |
| 243 | + } else { |
| 244 | + System.out.println("Skipping test. Could not find a ctags I could use in path."); |
| 245 | + } |
| 246 | + } else { |
| 247 | + System.out.println("Skipping test for bug 11896. Could not find a mkfifo in path."); |
| 248 | + } |
| 249 | + } |
207 | 250 | }
|
0 commit comments