Exemple #1
0
        void ReadErrorsAndWarnings(ezBuild.BuildTargetResult res, string sAbsWorkingDir)
        {
            if (res.ProcessRes == null)
            {
                return;
            }

            try
            {
                string sAbsErrorsPath = System.IO.Path.Combine(sAbsWorkingDir, "errors.txt");
                if (System.IO.File.Exists(sAbsErrorsPath))
                {
                    string sErrors = System.IO.File.ReadAllText(sAbsErrorsPath, Encoding.UTF8);
                    res.ProcessRes.ErrorOut += sErrors;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Reading errors.txt failed: {0}", ex.Message);
            }

            try
            {
                string sAbsWarningsPath = System.IO.Path.Combine(sAbsWorkingDir, "warnings.txt");
                if (System.IO.File.Exists(sAbsWarningsPath))
                {
                    string sWarnings = System.IO.File.ReadAllText(sAbsWarningsPath, Encoding.UTF8);
                    res.ProcessRes.ErrorOut += sWarnings;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Reading warnings.txt failed: {0}", ex.Message);
            }
        }
Exemple #2
0
        public ezBuild.BuildTargetResult BuildTarget(ezCMake.BuildTarget target, string sAbsWorkingDir)
        {
            ezBuild.BuildTargetResult res = new ezBuild.BuildTargetResult();
            res.Experimental = target.Experimental;
            res.Name         = target.Name;

            res.ProcessRes = ezProcessHelper.RunExternalExe("make", target.Name + " -j4", sAbsWorkingDir, res);
            res.Success    = (res.ProcessRes.ExitCode == 0);
            return(res);
        }
Exemple #3
0
        public ezBuild.BuildTargetResult BuildTarget(ezCMake.BuildTarget target, string sAbsWorkingDir)
        {
            ezBuild.BuildTargetResult res = new ezBuild.BuildTargetResult();
            res.Experimental = target.Experimental;
            res.Name         = target.Name;

            res.ProcessRes = ezProcessHelper.RunExternalExe("xcodebuild", string.Format("-configuration {0} -target {1}", _settings.BuildType, target.Name), sAbsWorkingDir, res);
            res.Success    = (res.ProcessRes.ExitCode == 0);
            CleanUpXcodeOutput(res.ProcessRes);
            return(res);
        }
Exemple #4
0
        public ezBuild.BuildTargetResult BuildTarget(ezCMake.BuildTarget target, string sAbsWorkingDir)
        {
            ezBuild.BuildTargetResult res = new ezBuild.BuildTargetResult();
            res.Experimental = target.Experimental;
            res.Name         = target.Name;

            if (!WriteBatFile(target, sAbsWorkingDir))
            {
                res.Error("Build '{0}' failed: bat file could not be written ({1})!", target.Name, System.IO.Path.Combine(sAbsWorkingDir, "build.bat"));
                return(res);
            }

            res.ProcessRes = ezProcessHelper.RunExternalExe("cmd", "/c build.bat", sAbsWorkingDir, res);
            res.Success    = (res.ProcessRes.ExitCode == 0);
            return(res);
        }
Exemple #5
0
        public TestResult Run(ezCMake.CMakeResult cmakeResults, ezBuild.BuildResult buildResults)
        {
            _Result.Clean();
            Console.WriteLine("*** Starting Test ***");

            if (!cmakeResults.Success)
            {
                _Result.Error("Test failed: CMake step failed, aborting!");
                return(_Result);
            }

            Stopwatch sw = new Stopwatch();

            sw.Start();

            int iFailedTargets = 0;
            List <ezCMake.TestTarget> targets = cmakeResults.TestTargets;

            foreach (ezCMake.TestTarget target in targets)
            {
                Console.WriteLine("** Starting Test of target '{0}' **", target.Name);
                // Only test targets which compiled successfully.
                ezBuild.BuildTargetResult buildTargetResult = buildResults.BuildTargetResults.Find(item => item.Name == target.Name);

                TestTargetResult testResult = null;

                if (buildTargetResult == null || !buildTargetResult.Success)
                {
                    // Dummy result for non-testable targets.
                    testResult      = new TestTargetResult();
                    testResult.Name = target.Name;
                    testResult.NeedsHardwareAccess = target.NeedsHardwareAccess;
                    testResult.Experimental        = target.Experimental;
                    testResult.ProcessRes          = null;

                    if (buildTargetResult == null)
                    {
                        testResult.Error("Target '{0}' has no equivalent build target, test aborted!", testResult.Name);
                    }
                    else if (!buildTargetResult.Success)
                    {
                        testResult.Error("Target '{0}' was not build successfully, test aborted!", testResult.Name);
                    }
                }
                else
                {
                    testResult = RunTest(target);
                }

                if (!testResult.Success && !testResult.Experimental)
                {
                    iFailedTargets++;
                }

                _Result.TestTargetResults.Add(testResult);
            }

            sw.Stop();
            _Result.Duration = sw.Elapsed.TotalSeconds;
            _Result.Success  = iFailedTargets == 0;

            if (iFailedTargets > 0)
            {
                _Result.Error("Test failed: {0} targets failed the test!", iFailedTargets);
            }
            return(_Result);
        }