final static public String WINDOWS_DEFAULT_DATA_PATH = "C:\\tizen-sdk-data";
//sdk configuration file
+ final static public String SDK_DATA_DIR_NAME = "tizen-sdk-data";
+ final static public String SDK_DATA_PATH = getSDKDataPath();
final static public String SDK_CONFIGURATION_DIR = ".info";
final static public String SDK_INFORMATION_FILE_NAME = "sdk.info";
final static public String SDK_INSTALLED_PACKAGE_LIST_FILE = "installedpackage.list";
final static public String SDK_INSTALLED_PACKAGE_LIST_PATH = PathUtil.get(SDK_CONFIGURATION_DIR, SDK_INSTALLED_PACKAGE_LIST_FILE);
+ //test file
+ final static public String SDK_TEST_DIR_NAME = "test";
+ final static public String SDK_INSTALLMANAGER_TEST_RESULT_DIR_PATH = PathUtil.get(SDK_DATA_PATH, SDK_TEST_DIR_NAME, INSTALLMANAGER_DIRECTORY_NAME);
+
static String getInstallManagerBinaryName() {
if (Platform.isLinux()) {
}
}
+ static String getSDKDataPath() {
+ if (Platform.isLinux() || Platform.isMacOS()) {
+ return PathUtil.getFromHome(SDK_DATA_DIR_NAME);
+ } else if (Platform.isWindows()) {
+ return PathUtil.getFromAppData(SDK_DATA_DIR_NAME);
+ } else {
+ throw new IMFatalException(ErrorCode.UNSUPPORTED_PLATFORM);
+ }
+ }
+
static String getIntallManagerShortcutImageName() {
if (Platform.isLinux()) {
return "tizen-sdk-installmanager.png";
public class OptionConstant {
//Option naming
public final static String OPTION_DISTRIBUTION = "-distribution";
+ public final static String OPTION_INIT_TEST = "-initTest";
+ public final static String OPTION_TEST = "-test";
//Option error message
public final static String MSG_DISTRIBUTION_NOT_PROVIDED = "Distribution setting is missing. Use the '-distribution <distribution>' option.";
public static boolean printDepGraph = false;
/**
+ * Initialize and exit install-manager for test.
+ */
+ public static boolean doInitTest = false;
+
+ public static boolean doTest = false;
+
+ /**
* Use Snapshot file.
*/
public static boolean snapshot = false;
Log.err("-distribution requires distribution description");
throw new IMFatalException(OptionConstant.MSG_DISTRIBUTION_NOT_PROVIDED);
}
+ } else if (arg.equals(OptionConstant.OPTION_INIT_TEST)) {
+ doInitTest = true;
+ } else if (arg.equals(OptionConstant.OPTION_TEST)) {
+ doTest = true;
} else if (arg.equals("-removeOldSDK")) {
doRemoveOldSDK = true;
} else if (arg.equals("-property")) {
package org.tizen.installmanager.core;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
import java.util.Date;
import org.tizen.installmanager.lib.Log;
+import org.tizen.installmanager.util.PathUtil;
public class Performance {
private static Date imStartTime = null;
}
}
+ public static void printTestResult() {
+ //get file name of test result
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
+ String testFileName = formatter.format(imStartTime) + ".txt";
+
+ String testResultFilePath = PathUtil.get(InstallManagerConstants.SDK_INSTALLMANAGER_TEST_RESULT_DIR_PATH, testFileName);
+ File testResultFile = new File(testResultFilePath);
+
+ if (!testResultFile.getParentFile().exists()) {
+ testResultFile.getParentFile().mkdirs();
+ }
+
+ BufferedWriter out = null;
+ try {
+ out = new BufferedWriter(new FileWriter(testResultFile));
+
+ out.write("*** InstallManager performance test ***");
+ out.newLine();
+ out.newLine();
+ out.write("The installmanager start time\t: " + imStartTime);
+ out.newLine();
+ out.write("The installmanager end time\t: " + imEndTime);
+ out.newLine();
+ out.write("The installation start time\t: " + installationStartTime);
+ out.newLine();
+ out.write("The installation end time\t: " + installationEndTime);
+ out.newLine();
+ out.newLine();
+
+ long progressSecond = getProgressTimeOfInstallation()/1000;
+
+ if (progressSecond >= 0) {
+ out.write("* Total time to install : About " + progressSecond/60 + " minutes"
+ +"(" + progressSecond + " seconds)");
+ out.newLine();
+ } else {
+ out.write("* Total time to install : Installation fail");
+ out.newLine();
+ }
+
+ } catch (IOException e) {
+ Log.ExceptionLog(e);
+ }
+
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ Log.ExceptionLog(e);
+ }
+ }
+ }
+
private static long getProgressTimeOfInstallation() {
if (installationStartTime == null || installationEndTime == null) {
return -1;
shell.getDisplay().asyncExec(new Runnable(){
public void run() {
//initialize installmanager
- progressbar.updateName("Connecting to package server.\nIt may take a minute...");
+ if (!Options.doInitTest) {
+ progressbar.updateName("Connecting to package server.\nIt may take a minute...");
+ }
shell.getDisplay().asyncExec(new Runnable() {
public void run() {
});
//init end
- progressbar.finish();
+ if (!Options.doInitTest) {
+ progressbar.finish();
+ }
}
});
if (!shell.isDisposed()) {
- progressbar.open();
+ if (!Options.doInitTest) {
+ progressbar.open();
+ }
}
Log.log("Window init end");
window.init();
+ if (Options.doInitTest) {
+ System.exit(0);
+ }
+
Log.log("after init");
if (Options.checkPackageUpdate) {
checkMetaPackageUpdate();
Performance.setIMEndTime();
Performance.printToLogFile();
+ if (Options.doTest) {
+ Performance.printTestResult();
+ }
+
Log.LogTitle("Installmanager finish");
Log.close();