Пример #1
0
        public void TestFault()
        {
            var args = new Dictionary <string, Variant>();

            args["Executable"]        = new Variant("CrashingFileConsumer");
            args["Arguments"]         = new Variant("Peach.Core.Test.OS.Linux.dll");
            args["RestartOnEachTest"] = new Variant("true");

            var m = new LinuxDebugger(null, null, args);

            m.SessionStarting();
            m.IterationStarting(1, false);
            Thread.Sleep(1000);
            m.IterationFinished();
            Assert.AreEqual(true, m.DetectedFault());
            Fault fault = m.GetMonitorData();

            Assert.NotNull(fault);
            Assert.AreEqual(1, fault.collectedData.Count);
            Assert.True(fault.collectedData.ContainsKey("StackTrace.txt"));
            Assert.Greater(fault.collectedData["StackTrace.txt"].Length, 0);
            Assert.True(fault.description.Contains("PossibleStackCorruption"));
            m.SessionFinished();
            m.StopMonitor();
        }
Пример #2
0
        public void TestCpuKill()
        {
            var args = new Dictionary <string, Variant>();

            args["Executable"]  = new Variant("CrashableServer");
            args["Arguments"]   = new Variant("127.0.0.1 12346");
            args["StartOnCall"] = new Variant("Foo");

            var m = new LinuxDebugger(null, null, args);

            m.SessionStarting();
            m.IterationStarting(1, false);

            m.Message("Action.Call", new Variant("Foo"));
            Thread.Sleep(1000);

            var before = DateTime.Now;

            m.IterationFinished();
            var after = DateTime.Now;

            var span = (after - before);

            Thread.Sleep(1000);
            Assert.AreEqual(false, m.DetectedFault());
            m.SessionFinished();
            m.StopMonitor();

            Assert.GreaterOrEqual(span.TotalSeconds, 0.0);
            Assert.LessOrEqual(span.TotalSeconds, 0.5);
        }
Пример #3
0
        public void TestNoFault()
        {
            var args = new Dictionary <string, Variant>();

            args["Executable"] = new Variant("CrashingFileConsumer");

            var m = new LinuxDebugger(null, null, args);

            m.SessionStarting();
            m.IterationStarting(1, false);
            Thread.Sleep(1000);
            m.IterationFinished();
            Assert.AreEqual(false, m.DetectedFault());
            m.SessionFinished();
            m.StopMonitor();
        }