Beispiel #1
0
        public static int SingleTestMode(Options opts)
        {
            Console.WriteLine("*** Running single test with id '{0}' not storing results in database...", opts.TestId);

            DrtStore store = new DrtStore("perf-suite-set/drtlist.xml");
            DrtItem  item  = store.GetDrtItemForId(opts.TestId);

            if (item == null)
            {
                Console.WriteLine("*** Test '{0}' not found!", opts.TestId);
                return(128);
            }

            Console.WriteLine("*** Running [{0}]", item);

            DrtResult r = item.Run();

            ResultDbEntry resultEntry = new ResultDbEntry();

            if (r == null)
            {
                resultEntry.Time = 0;
                Console.WriteLine("*** Averaged result: 0 (FAILURE)");
            }
            else
            {
                resultEntry.Time = r.AveragedTime;
                Console.WriteLine("*** Averaged result: {0}usec", r.AveragedTime);
            }

            return(0);
        }
Beispiel #2
0
        public static int AllTestsMode(Options opts)
        {
            Console.WriteLine("*** Pass name is '{0}'...", opts.ShortName);

            Database.Initialize(opts.DatabaseFile);
            Database.BeginTransaction();

            PassDbEntry passEntry = new PassDbEntry();

            passEntry.ShortName = opts.ShortName;
            passEntry.Author    = opts.Author;
            passEntry.ChangeLog = opts.ChangeLog;
            passEntry.Date      = DateTime.Now;

            Database.Put(passEntry);

            DrtStore store = new DrtStore("perf-suite-set/drtlist.xml");

            foreach (DrtItem item in store.Items)
            {
                Console.WriteLine("*** Running [{0}]", item);

                ItemDbEntry itemEntry = Database.GetItemEntryByUniqueId(item.UniqueId);
                if (itemEntry == null)
                {
                    Console.WriteLine("*** [{0}] not yet in the database, adding...", item);
                    itemEntry           = new ItemDbEntry();
                    itemEntry.UniqueId  = item.UniqueId;
                    itemEntry.Name      = item.Name;
                    itemEntry.InputFile = item.InputFile;
                    Database.Put(itemEntry);
                }

                DrtResult r = item.Run();

                ResultDbEntry resultEntry = new ResultDbEntry();
                resultEntry.Pass = passEntry;
                resultEntry.Item = itemEntry;

                if (r == null)
                {
                    resultEntry.Time = 0;
                    Console.WriteLine("*** Averaged result: 0 (FAILURE)");
                }
                else
                {
                    resultEntry.Time = r.AveragedTime;
                    Console.WriteLine("*** Averaged result: {0}usec", r.AveragedTime);
                }

                Database.Put(resultEntry);
            }

            Database.CommitTransaction();

            return(0);
        }
Beispiel #3
0
        public DrtResult Run()
        {
            DrtResult result = null;
            Process   proc   = new Process();

            try {
                string tmpFileName = Path.GetTempFileName();

                string arguments = String.Format("-f \"{0}\" -s \"{1}\" -e \"{2}\" -i \"{3}\" -n \"{4}\" -r \"{5}\" -t \"{6}\" -w \"{7}\" -h \"{8}\"",
                                                 FullFileName,
                                                 StartTime,
                                                 EndTime,
                                                 Interval,
                                                 Runs,
                                                 tmpFileName,
                                                 Timeout,
                                                 Width,
                                                 Height);

                proc.EnableRaisingEvents = false;
                proc.StartInfo.FileName  = "perf-tool";
                proc.StartInfo.Arguments = arguments;
                proc.Start();
                proc.WaitForExit();

                if (proc.ExitCode == 0)
                {
                    result = new DrtResult(tmpFileName);
                }
            } catch {
                result = null;
            } finally {
                proc.Close();
                proc.Dispose();
            }

            return(result);
        }
Beispiel #4
0
		public DrtResult Run ()
		{
			DrtResult result = null;
			Process proc = new Process ();

			try {
				string tmpFileName = Path.GetTempFileName ();

				string arguments = String.Format ("-f \"{0}\" -s \"{1}\" -e \"{2}\" -i \"{3}\" -n \"{4}\" -r \"{5}\" -t \"{6}\" -w \"{7}\" -h \"{8}\"", 
								  FullFileName, 
								  StartTime, 
								  EndTime, 
								  Interval, 
								  Runs, 
							 	  tmpFileName, 
								  Timeout, 
								  Width, 
								  Height);

				proc.EnableRaisingEvents = false; 
				proc.StartInfo.FileName = "perf-tool";
				proc.StartInfo.Arguments = arguments;
				proc.Start();
				proc.WaitForExit();

				if (proc.ExitCode == 0)
					result = new DrtResult (tmpFileName);
			} catch {
				result = null;
			} finally {
				proc.Close ();
				proc.Dispose ();
			}

			return result;
		}