コード例 #1
0
ファイル: MonsterStarter.cs プロジェクト: fbizuneh/Igor
        public static void CheckForAndRunTest()
        {
            string TestName = Environment.GetEnvironmentVariable(MonsterTestCore.MonsterStarterTestNameEnvVariable);

//			MonsterDebug.Log("Checking for test " + TestName);

            if (TestName != null && TestName != "" && (TestRunnerInst == null || TestName != CurrentTestName))
            {
                if (TestRunnerInst == null)
                {
                    TestRunnerInst = new MonsterTestRunner();
                }

                TestRunnerInst.PreloadTest(TestName);
                TestRunnerInst.StartTest(TestName);

                MonsterDebug.Log("Starting test " + TestName);

                CurrentTestName = TestName;
            }

            if (TestRunnerInst != null && TestRunnerInst.RunTests())
            {
                MonsterDebug.Log("Finished running test " + TestName);

                Application.Quit();
            }
        }
コード例 #2
0
        public virtual bool RunTest(string TestName)
        {
            MonsterDebug.Log("Attempting to run test " + TestName + " on a standalone copy of the game.");

            Environment.SetEnvironmentVariable(MonsterTestCore.MonsterStarterTestNameEnvVariable, TestName);

            string AppPath = "";

            if (IgorJobConfig.IsStringParamSet(MonsterTestCore.ExplicitAppPathFlag))
            {
                AppPath = IgorJobConfig.GetStringParam(MonsterTestCore.ExplicitAppPathFlag);
            }
            else
            {
                foreach (string CurrentProduct in IgorCore.GetModuleProducts())
                {
                    if (CurrentProduct.Contains(".app"))
                    {
                        AppPath = CurrentProduct.Substring(0, CurrentProduct.IndexOf(".app") + 4);
                    }
                    else if (CurrentProduct.EndsWith(".exe"))
                    {
                        AppPath = CurrentProduct;
                    }
                }
            }

            if (AppPath.EndsWith(".app"))
            {
                AppPath = Path.Combine(AppPath, Path.Combine("Contents", Path.Combine("MacOS", AppPath.Substring(AppPath.LastIndexOf('/') + 1, AppPath.Length - AppPath.LastIndexOf('/') - 5))));

                IgorRuntimeUtils.SetFileExecutable(AppPath);
            }

            string AppOutput = "";
            string AppError  = "";

            int RunAppRC = IgorRuntimeUtils.RunProcessCrossPlatform(AppPath, AppPath, "", Path.GetFullPath("."), ref AppOutput, ref AppError);

            if (RunAppRC != 0)
            {
                MonsterDebug.LogError("Failed to run test.  App retruned RC " + RunAppRC + "!\n\nOutput:\n" + AppOutput + "\n\nError:\n" + AppError);

                return(true);
            }

            MonsterDebug.Log("Test ran successfully!\n\nOutput:\n" + AppOutput + "\n\nError:\n" + AppError);

            return(true);
        }
コード例 #3
0
        public static void CheckForAndRunJobs()
        {
            string JobName = Environment.GetEnvironmentVariable(MonsterTestCore.MonsterLauncherJobNameEnvVariable);

            MonsterDebug.Log("Checking for job " + JobName);

            if (JobName != null && JobName != "" && JobName != CurrentJobName)
            {
                IgorConfig.SetJobToRunByName(JobName);

                MonsterDebug.Log("Starting job " + JobName);

                CurrentJobName = JobName;
            }

            IgorCore.HandleJobStatus(IgorCore.RunJob(false));
        }
コード例 #4
0
        public virtual void BuildLauncher(BuildTarget TargetTestPlatform)
        {
            MonsterDebug.Log("Building launcher for platform " + TargetTestPlatform);

            string MethodName = GetBuildMethodName(TargetTestPlatform);

            if (MethodName == "")
            {
                MonsterDebug.LogError("Test platform " + TargetTestPlatform + " is not supported yet.  Please add support for it!");
            }

            string MonsterLauncherProjectPath = Path.Combine(Application.temporaryCachePath, "MonsterLauncher");

            MonsterDebug.Log("Creating new project at " + MonsterLauncherProjectPath);

            if (Directory.Exists(MonsterLauncherProjectPath))
            {
                MonsterDebug.Log("Cleaning up old project first!");

                IgorRuntimeUtils.DeleteDirectory(MonsterLauncherProjectPath);
            }

            Directory.CreateDirectory(MonsterLauncherProjectPath);

            string LauncherProjectAssetsIgorFolder = Path.Combine(MonsterLauncherProjectPath, Path.Combine("Assets", "Igor"));

            Directory.CreateDirectory(LauncherProjectAssetsIgorFolder);

            MonsterDebug.Log("Copying project files.");

            IgorRuntimeUtils.DirectoryCopy(Path.Combine(Path.GetFullPath("."), Path.Combine("Assets", "Igor")), LauncherProjectAssetsIgorFolder, true);

            string OldLaunchersFolder = Path.Combine(LauncherProjectAssetsIgorFolder, Path.Combine("Monster", "Launchers"));

            IgorRuntimeUtils.DeleteDirectory(OldLaunchersFolder);

            MonsterDebug.Log("Copying Igor config.");

            string StreamingAssetsFolder = Path.Combine(MonsterLauncherProjectPath, Path.Combine("Assets", Path.Combine("StreamingAssets", "Igor")));

            Directory.CreateDirectory(StreamingAssetsFolder);

            if (File.Exists(IgorConfig.DefaultConfigPath))
            {
                IgorRuntimeUtils.CopyFile(IgorConfig.DefaultConfigPath, Path.Combine(StreamingAssetsFolder, IgorConfig.IgorConfigFilename));
            }

            string BuildLauncherOutput = "";
            string BuildLauncherError  = "";

            MonsterDebug.Log("Attempting to build launcher.");

            int ReturnCode = IgorRuntimeUtils.RunProcessCrossPlatform(EditorApplication.applicationPath + "/Contents/MacOS/Unity", EditorApplication.applicationPath,
                                                                      "-projectPath \"" + MonsterLauncherProjectPath + "\" -buildmachine -executeMethod " + MethodName + " -logfile Monster.log",
                                                                      MonsterLauncherProjectPath, ref BuildLauncherOutput, ref BuildLauncherError);

            if (ReturnCode != 0)
            {
                MonsterDebug.LogError("Something went wrong with the build!  Returned error code " + ReturnCode + "\n\nOutput:\n" + BuildLauncherOutput + "\n\nError:\n" + BuildLauncherError);

                return;
            }

            MonsterDebug.Log("Launcher successfully built!");

            string MonsterLauncherPath = Path.Combine(MonsterTestCore.MonsterLocalDirectoryRoot, "Launchers");

            if (!Directory.Exists(MonsterLauncherPath))
            {
                Directory.CreateDirectory(MonsterLauncherPath);
            }

            MonsterDebug.Log("Copying launcher back to project.");

            CopyLauncherToProjectPath(TargetTestPlatform, MonsterLauncherProjectPath, MonsterLauncherPath);

            IgorRuntimeUtils.DeleteDirectory(MonsterLauncherProjectPath);

            string MonsterRunPyFile = Path.Combine(MonsterLauncherPath, "MonsterRun.py");

            if (File.Exists(MonsterRunPyFile))
            {
                IgorRuntimeUtils.DeleteFile(MonsterRunPyFile);
            }

            string MonsterRunPyFileLatest = Path.Combine(IgorUpdater.LocalModuleRoot, Path.Combine("MonsterTest", Path.Combine("Core", Path.Combine("Runtime", "MonsterRun.py"))));

            if (File.Exists(MonsterRunPyFileLatest))
            {
                MonsterDebug.Log("Copying latest MonsterRun.py to the Launchers folder.");

                IgorRuntimeUtils.CopyFile(MonsterRunPyFileLatest, MonsterRunPyFile);
            }

            MonsterDebug.Log("Done building launcher for platform " + TargetTestPlatform);
        }
コード例 #5
0
ファイル: MonsterDialogue.cs プロジェクト: fbizuneh/Igor
        public virtual void NewLine(string LineID)
        {
            MonsterDebug.Log("New line \"" + LineID + "\"");

            WaitTimeLeft = Random.Range(1.0f, 2.0f);
        }
コード例 #6
0
 public virtual void TestFailed()
 {
     MonsterDebug.Log("Test failed!");
 }
コード例 #7
0
 public virtual void TestSucceeded()
 {
     MonsterDebug.Log("Test succeeded!");
 }