예제 #1
0
        public void TestExitEarlyFault1()
        {
            Variant foo = new Variant("foo");
            Variant bar = new Variant("bar");

            // FaultOnEarlyExit doesn't fault when stop message is sent

            Dictionary <string, Variant> args = new Dictionary <string, Variant>();

            args["Command"]           = new Variant("echo");
            args["Arguments"]         = new Variant("hello");
            args["StartOnCall"]       = foo;
            args["WaitForExitOnCall"] = bar;
            args["FaultOnEarlyExit"]  = new Variant("true");

            CrashWrangler w = new CrashWrangler(null, "name", args);

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

            w.Message("Action.Call", foo);
            w.Message("Action.Call", bar);

            w.IterationFinished();

            Assert.AreEqual(false, w.DetectedFault());

            w.SessionFinished();
            w.StopMonitor();
        }
예제 #2
0
        public void TestExitOnCallFault()
        {
            Variant foo = new Variant("foo");
            Variant bar = new Variant("bar");

            Dictionary <string, Variant> args = new Dictionary <string, Variant>();

            args["Command"]            = new Variant("nc");
            args["Arguments"]          = new Variant("-l 12345");
            args["StartOnCall"]        = foo;
            args["WaitForExitOnCall"]  = bar;
            args["WaitForExitTimeout"] = new Variant("2000");
            args["NoCpuKill"]          = new Variant("true");

            CrashWrangler w = new CrashWrangler(null, "name", args);

            w.Message("Action.Call", foo);
            w.Message("Action.Call", bar);

            w.IterationFinished();

            Assert.AreEqual(true, w.DetectedFault());
            Fault f = w.GetMonitorData();

            Assert.NotNull(f);
            Assert.AreEqual("ProcessFailedToExit", f.folderName);

            w.SessionFinished();
            w.StopMonitor();
        }
예제 #3
0
        public void TestExitOnCallNoFault()
        {
            Variant foo = new Variant("foo");
            Variant bar = new Variant("bar");

            Dictionary <string, Variant> args = new Dictionary <string, Variant>();

            args["Command"]           = new Variant("echo");
            args["Arguments"]         = new Variant("hello");
            args["StartOnCall"]       = foo;
            args["WaitForExitOnCall"] = bar;
            args["NoCpuKill"]         = new Variant("true");

            CrashWrangler w = new CrashWrangler(null, "name", args);

            w.Message("Action.Call", foo);
            w.Message("Action.Call", bar);

            w.IterationFinished();

            Assert.AreEqual(false, w.DetectedFault());

            w.SessionFinished();
            w.StopMonitor();
        }
예제 #4
0
        public void TestStartOnCall()
        {
            Variant foo = new Variant("foo");

            Dictionary <string, Variant> args = new Dictionary <string, Variant>();

            args["Command"]            = new Variant("nc");
            args["Arguments"]          = new Variant("-l 12345");
            args["StartOnCall"]        = foo;
            args["WaitForExitTimeout"] = new Variant("2000");
            args["NoCpuKill"]          = new Variant("true");

            CrashWrangler w = new CrashWrangler(null, "name", args);

            w.Message("Action.Call", foo);
            Thread.Sleep(1000);

            var before = DateTime.Now;

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

            var span = (after - before);

            Assert.AreEqual(false, w.DetectedFault());

            w.SessionFinished();
            w.StopMonitor();

            Assert.GreaterOrEqual(span.TotalSeconds, 1.8);
            Assert.LessOrEqual(span.TotalSeconds, 2.2);
        }
예제 #5
0
        public void TestExitEarlyFault3()
        {
            Variant foo = new Variant("foo");

            // FaultOnEarlyExit doesn't fault when StartOnCall is used

            Dictionary <string, Variant> args = new Dictionary <string, Variant>();

            args["Command"]          = new Variant("nc");
            args["Arguments"]        = new Variant("-l 12345");
            args["StartOnCall"]      = foo;
            args["FaultOnEarlyExit"] = new Variant("true");

            CrashWrangler w = new CrashWrangler(null, "name", args);

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

            w.Message("Action.Call", foo);

            w.IterationFinished();

            Assert.AreEqual(false, w.DetectedFault());

            w.SessionFinished();
            w.StopMonitor();
        }
예제 #6
0
        public void TestExitEarlyFault2()
        {
            Variant foo = new Variant("foo");

            // FaultOnEarlyExit faults when StartOnCall is used and stop message is not sent

            Dictionary <string, Variant> args = new Dictionary <string, Variant>();

            args["Command"]          = new Variant("echo");
            args["Arguments"]        = new Variant("hello");
            args["StartOnCall"]      = foo;
            args["FaultOnEarlyExit"] = new Variant("true");

            CrashWrangler w = new CrashWrangler(null, "name", args);

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

            w.Message("Action.Call", foo);

            System.Threading.Thread.Sleep(1000);

            w.IterationFinished();

            Assert.AreEqual(true, w.DetectedFault());
            Fault f = w.GetMonitorData();

            Assert.NotNull(f);
            Assert.AreEqual("ProcessExitedEarly", f.folderName);


            w.SessionFinished();
            w.StopMonitor();
        }