Exemplo n.º 1
0
        public static void Save(AndroidDeviceInfo adi, Project project)
        {
            var settings = new XmlWriterSettings {
                CloseOutput  = true,
                Encoding     = Utilities.UTF8NoBOM,
                Indent       = true,
                IndentChars  = "\t",
                NewLineChars = Environment.NewLine,
            };

            string outputFile = Path.Combine(project.FullDataDirectoryPath, Constants.RawResultsFileName);

            using (var writer = XmlWriter.Create(outputFile, settings)) {
                writer.WriteStartElement("xptrRaw");
                writer.WriteAttributeString("ticksUTC", project.WhenUTC.Ticks.ToString());
                writer.WriteAttributeString("configuration", project.Configuration);

                writer.WriteStartElement("device");
                writer.WriteAttributeString("model", adi.Model);
                writer.WriteAttributeString("architecture", adi.Architecture);
                writer.WriteAttributeString("sdk", adi.SdkVersion);
                writer.WriteEndElement();                  // device

                writer.WriteStartElement("projectGitInfo");
                writer.WriteAttributeString("branch", project.GitBranch ?? String.Empty);
                writer.WriteAttributeString("commit", project.GitCommit ?? String.Empty);
                writer.WriteEndElement();                  // projectGitInfo

                writer.WriteStartElement("xamarinAndroidVersion");
                writer.WriteAttributeString("version", project.XAVersion?.Version ?? String.Empty);
                writer.WriteAttributeString("branch", project.XAVersion?.Branch ?? String.Empty);
                writer.WriteAttributeString("commit", project.XAVersion?.Commit ?? String.Empty);
                writer.WriteAttributeString("rootDir", project.XAVersion?.RootDir ?? String.Empty);
                writer.WriteEndElement();                  // xamarinAndroidVersion

                writer.WriteStartElement("sessionLog");
                writer.WriteAttributeString("path", Constants.LogFileName);
                writer.WriteEndElement();                  // sessionLog

                writer.WriteStartElement("runs");
                writer.WriteAttributeString("repetitions", project.RepetitionCount.ToString());

                foreach (RunDefinition run in project.Runs)
                {
                    run.SaveRaw(writer);
                }

                writer.WriteEndElement();                  // runs

                writer.WriteEndElement();                  // xptrRaw
                writer.Flush();
            }
        }
Exemplo n.º 2
0
 void WriteDescription(StreamWriter sw, DateTime date, string configuration, XAVersionInfo xaVersion, AndroidDeviceInfo adi)
 {
     sw.WriteLine();
     sw.WriteLine($"Date (UTC): **{date}**  ");
     sw.WriteLine($"App configuration: **{configuration}**  ");
     sw.WriteLine();
     sw.WriteLine("Xamarin.Android  ");
     sw.WriteLine($"  - Version: **{xaVersion.Version}**  ");
     sw.WriteLine($"  - Branch: **{xaVersion.Branch}**  ");
     sw.WriteLine($"  - Commit: **{xaVersion.Commit}**  ");
     sw.WriteLine();
     sw.WriteLine("Device  ");
     sw.WriteLine($"  - Model: **{adi.Model}**  ");
     sw.WriteLine($"  - Native architecture: **{adi.Architecture}**  ");
     sw.WriteLine($"  - SDK version: **{adi.SdkVersion}**  ");
     sw.WriteLine();
 }
Exemplo n.º 3
0
        public async Task <bool> Run()
        {
            var adb = new AdbRunner(context);
            AndroidDeviceInfo?info = await adb.GetDeviceInfo();

            if (info == null)
            {
                Log.FatalLine("Failed to obtain Android device info");
                return(false);
            }
            adi = info;
            Log.InfoLine($"Device: {adi.Model}");
            Log.InfoLine($"Device architecture: {adi.Architecture}");
            Log.InfoLine($"Device SDK: {adi.SdkVersion}");

            if (!await adb.SetPropertyValue("debug.mono.log", "default,timing=bare"))
            {
                Log.FatalLine("Failed to set Mono debugging properties");
                return(false);
            }

            if (!await adb.SetLogcatBufferSize("16M"))
            {
                Log.WarningLine("Failed to set logcat buffer size");
            }

            Utilities.CreateDirectory(FullDataDirectoryPath);

            foreach (RunDefinition run in runs)
            {
                if (run.RunPerformanceTest)
                {
                    if (!await RunPerformanceTest(run, adb))
                    {
                        return(false);
                    }
                }
            }

            foreach (RunDefinition run in runs)
            {
                if (run.RunManagedProfiler)
                {
                    if (!await RunManagedProfiler(run))
                    {
                        return(false);
                    }
                }
            }

            foreach (RunDefinition run in runs)
            {
                if (run.RunNativeProfiler)
                {
                    if (!await RunNativeProfiler(run))
                    {
                        return(false);
                    }
                }
            }

            RawResults.Save(adi, this);

            return(true);
        }