X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fbin%2FCommandsTest.java;fp=test%2Fjalview%2Fbin%2FCommandsTest.java;h=7b427371a7a6909c634ae4ae58fc83d9d6668fca;hb=ac7c83b360752f04362700dcd279b5524a559da9;hp=c4fbddb21cc5a9ffa6b6a39469693655c88b66f4;hpb=6e58e6086a2e92fb3ffa66206134c489e2fc26ba;p=jalview.git diff --git a/test/jalview/bin/CommandsTest.java b/test/jalview/bin/CommandsTest.java index c4fbddb..7b42737 100644 --- a/test/jalview/bin/CommandsTest.java +++ b/test/jalview/bin/CommandsTest.java @@ -116,7 +116,8 @@ public class CommandsTest } */ - @Test(groups = { "Functional", "testTask3" }, dataProvider = "cmdLines") + @Test(groups = { "Functional", "testTask3" }, dataProvider = "cmdLines", singleThreaded = true) + public void commandsOpenTest(String cmdLine, boolean cmdArgs, int numFrames, String[] sequences) { @@ -168,7 +169,7 @@ public class CommandsTest @Test( groups = { "Functional", "testTask3" }, - dataProvider = "structureImageOutputFiles") + dataProvider = "structureImageOutputFiles", singleThreaded = true) public void structureImageOutputTest(String cmdLine, String[] filenames) throws IOException { @@ -190,13 +191,17 @@ public class CommandsTest Assert.assertTrue(Files.size(file.toPath()) > 0, "File '" + filename + "' has no content from '" + cmdLine + "'"); // make sure the successive output files get bigger! - if (lastFile != null) { - Assert.assertTrue(Files.size(file.toPath()) > Files.size(lastFile.toPath())); - System.out.println("this file: " + file + " +" + Files.size(file.toPath()) + " greater than " - + Files.size(lastFile.toPath())); - } - // remember it for next file - lastFile = file; + if (lastFile != null) + { + waitForLastWrite(file,25); + + if (Files.size(file.toPath()) > Files + .size(lastFile.toPath())) + Assert.assertTrue(Files.size(file.toPath()) > Files + .size(lastFile.toPath())); + } + // remember it for next file + lastFile = file; } } catch (Exception x) { @@ -209,7 +214,22 @@ public class CommandsTest } } - @Test(groups = "Functional", dataProvider = "argfileOutputFiles") + private static long waitForLastWrite(File file, int i) throws IOException + { + long lastSize,stableSize =Files.size(file.toPath()); + // wait around until we are sure the file has been completely written. + do { + lastSize = stableSize; + try { + Thread.sleep(i); + } catch (Exception x) {} + stableSize=Files.size(file.toPath()); + } while (stableSize!=lastSize); + return stableSize; + } + + @Test(groups = "Functional", dataProvider = "argfileOutputFiles", singleThreaded = true) + public void argFilesGlobAndSubstitutionsTest(String cmdLine, String[] filenames) throws IOException {