Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
        public void TestExitTime()
        {
            Dictionary <string, Variant> args = new Dictionary <string, Variant>();

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

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

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

            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, 0.0);
            Assert.LessOrEqual(span.TotalSeconds, 0.1);
        }
Ejemplo n.º 5
0
        public void BadCommand()
        {
            Dictionary <string, Variant> args = new Dictionary <string, Variant>();

            args["Command"] = new Variant("foo");

            CrashWrangler w        = new CrashWrangler(null, "name", args);
            string        expected = "CrashWrangler handler could not find command \"foo\".";

            Assert.Throws <PeachException>(delegate() { w.SessionStarting(); }, expected);
        }
Ejemplo n.º 6
0
        public void BadHandler()
        {
            Dictionary <string, Variant> args = new Dictionary <string, Variant>();

            args["Command"]     = new Variant("foo");
            args["ExecHandler"] = new Variant("foo");

            CrashWrangler w        = new CrashWrangler(null, "name", args);
            string        expected = "CrashWrangler could not start handler \"foo\" - No such file or directory.";

            Assert.Throws <PeachException>(delegate() { w.SessionStarting(); }, expected);
        }
Ejemplo n.º 7
0
        public void TestCommandQuoting()
        {
            Dictionary <string, Variant> args = new Dictionary <string, Variant>();

            args["Command"]           = new Variant("/Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player");
            args["Arguments"]         = new Variant("");
            args["RestartOnEachTest"] = new Variant("true");
            args["FaultOnEarlyExit"]  = new Variant("true");

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

            w.SessionStarting();
            Thread.Sleep(1000);

            Assert.AreEqual(false, w.DetectedFault());
            w.SessionFinished();
            w.StopMonitor();
        }