[Esbox-commits] r1231 - branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests

eswartz at garage.maemo.org eswartz at garage.maemo.org
Tue Feb 17 17:47:00 EET 2009


Author: eswartz
Date: 2009-02-17 17:47:00 +0200 (Tue, 17 Feb 2009)
New Revision: 1231

Modified:
   branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java
Log:
Commit non-functioning test for sb2 bug reporting

Modified: branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java	2009-02-13 21:45:47 UTC (rev 1230)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java	2009-02-17 15:47:00 UTC (rev 1231)
@@ -10,15 +10,20 @@
  *******************************************************************************/
 package org.maemo.esbox.scratchbox.tests;
 
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.junit.Test;
 import org.maemo.esbox.internal.scratchbox.sb2.provider.Scratchbox2SDKProvider;
 import org.maemo.mica.common.core.*;
 import org.maemo.mica.common.core.process.*;
+import org.maemo.mica.common.core.process.ProcessLauncherUtils.Results;
 import org.maemo.mica.common.core.sdk.*;
 import org.maemo.mica.common.core.tests.TestUtils;
 
+import java.io.OutputStream;
 import java.util.Collections;
 import java.util.List;
 
@@ -107,5 +112,47 @@
 		});
 	}
 
+	/**
+	 * This test won't work until sb2 is fixed.
+	 * See ESbox bug 3469.
+	 * @throws Exception
+	 */
+	//@Test
+	public void TODO_testSB2CurrentDirectory() throws Exception {
+		runOverTargets(new IRunner() {
 
+			public void run(ISDKTarget target) throws Exception {
+				IPath targetTmpDir = new Path("/tmp/_test_directory_");
+				
+				IFileStore dir = target.getTargetFileSystemAccess().getFileStore(
+						targetTmpDir);
+				
+				// clean first
+				dir.delete(0, null);
+				
+				// then make
+				dir.mkdir(0, null);
+				
+				assertTrue(dir.fetchInfo().exists());
+				
+				// make a file there
+				IFileStore store = dir.getChild("test.txt");
+				OutputStream os = store.openOutputStream(0, null);
+				os.write("Hello world\n".getBytes());
+				os.close();
+				
+				IProcessLauncherFactory processLauncherFactory = target
+						.getProcessLauncherFactory();
+				IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+						processLauncherFactory,
+						targetTmpDir,
+						CommandLineArguments.createFromVarArgs("/bin/cat", "test.txt"));
+				
+				Results results = ProcessLauncherUtils.launchAndReadStandardStreams(processLauncher, null);
+				assertEquals("Running under /tmp:\n\n"+results.stdout+results.stderr, 0, results.exitCode);
+				assertEquals("Hello world", results.stdout.trim());
+			}
+		});
+	}
+
 }



More information about the Esbox-commits mailing list