Esempio n. 1
0
 private static void ConfigureStorageCard(IDeviceEmulatorManagerVMID emulator, string storageCardPath)
 {
     if (!String.IsNullOrEmpty(storageCardPath))
     {
         emulator.Connect();
         EmulatorHelper.SetStorageCardPath(emulator, storageCardPath);
         emulator.Shutdown(SaveState);
     }
 }
Esempio n. 2
0
        static int Main(string[] args)
        {
            Arguments arguments = new Arguments(args);

            string targetFrameworkVersion = arguments["version"];

            if (targetFrameworkVersion == null)
            {
                targetFrameworkVersion = "2.0";
            }

            string db4oDistPath = arguments["dir.dll.compact"];

            if (db4oDistPath == null)
            {
                Help();
                return(InvalidProgramParameters);
            }

            string cfAppName = arguments["app.name"];

            if (string.IsNullOrEmpty(cfAppName))
            {
                Help();
                return(InvalidProgramParameters);
            }

            string deployFileFilter = AppendExtraFilterForDeploy(arguments["deploy.extra.files"]);
            int    ret;

            try
            {
                Console.Error.WriteLine("CompactFrameworkTestHelper v1.2 - Copyright (C) 2009 Versant Inc.\r\n");
                Console.Error.WriteLine("\tCF App: {0}", cfAppName);
                Console.Error.WriteLine("\tCF Target Version: {0}", targetFrameworkVersion);
                Console.Error.WriteLine("\tFolder: {0}", db4oDistPath);
                Console.Error.WriteLine("\tDeployed File Types: {0}", deployFileFilter);
                Console.Error.WriteLine("\tArguments: {0}", arguments["app.args"] ?? "no argument");

                ConfigureEmulator(arguments["dir.storagecard"]);

                Device device = EmulatorHelper.GetDevice();
                device.Connect();

                DeployDotNetFramework(device, targetFrameworkVersion);

                try
                {
                    EmulatorHelper.CopyFiles(device.GetFileDeployer(), Path.Combine(db4oDistPath, "*"), DeviceTestPath, deployFileFilter);

                    RemoteProcess process = device.GetRemoteProcess();
                    if (process.Start(DeviceTestPath + cfAppName, "\"" + arguments["app.args"] ?? String.Empty + "\""))
                    {
                        ret = WaitToFinishOrTimeout(process, new TimeSpan(0, 5, 0, 0));

                        EmulatorHelper.PublishTestLog(device.GetFileDeployer(), db4oDistPath);
                        if (ret != 0)
                        {
                            Console.Error.WriteLine("{0} returned: {1}", cfAppName, ret);
                        }
                    }
                    else
                    {
                        Console.Error.WriteLine("Failled to start application '{0}' in emulator", cfAppName);
                        ret = FailedLaunchingTests;
                    }
                }
                finally
                {
                    device.Disconnect();
                    IDeviceEmulatorManagerVMID virtualDevice = EmulatorHelper.GetVirtualDevice();
                    virtualDevice.Shutdown(DoNotSaveState);
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error running {0}\r\n{1}", cfAppName, ex);
                ret = ExceptionRunningTests;
            }

            return(ret);
        }
Esempio n. 3
0
        private static void ConfigureEmulator(string storageCard)
        {
            IDeviceEmulatorManagerVMID emulator = EmulatorHelper.GetVirtualDevice();

            ConfigureStorageCard(emulator, storageCard);
        }