コード例 #1
0
ファイル: PerfSuiteRunner.cs プロジェクト: dfr0/moon
		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;

		}
コード例 #2
0
ファイル: PerfSuiteRunner.cs プロジェクト: dfr0/moon
		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;

		}
コード例 #3
0
ファイル: PerfSuiteRunner.cs プロジェクト: dfr0/moon
		public static int Main (string [] args)
		{
			Options opts = new Options ();

			try {
				opts.ProcessArgs (args);
			}
			catch (OptionException e) {
				Console.Write ("perfsuiterunner: {0}", e.Message);
				return 0;
			}

			if (opts.TestId != String.Empty)
				return SingleTestMode (opts);
			else
				return AllTestsMode (opts);

		}