Exemplo n.º 1
0
        public void TestTwoPhaseCommit()
        {
            var tempDir   = Directory.CreateDirectory(Path.Combine(Constants.ScratchParentDirectory, "TestTwoPhaseCommit"));
            var allPFiles = new[]
            {
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "TwoPhaseCommit", "Client.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "TwoPhaseCommit", "Coordinator.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "TwoPhaseCommit", "Events.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "TwoPhaseCommit", "Participant.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "TwoPhaseCommit", "TestDriver.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "TwoPhaseCommit", "Timer.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "TwoPhaseCommit", "Spec.p"))
            };

            var foreignCode = new[]
            {
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "TwoPhaseCommit", "ForeignCode.cs"))
            };

            var testCase = new CompilerTestCase(
                tempDir,
                new PSharpRunner(allPFiles, foreignCode),
                new CompileSuccessValidator());

            TestAssertions.AssertTestCase(testCase);
        }
Exemplo n.º 2
0
        public void TestRegressions(DirectoryInfo testDir)
        {
            var scratchDir     = Directory.CreateDirectory(Constants.ScratchParentDirectory);
            var factory        = new TestCaseFactory(scratchDir);
            var testCasePSharp = factory.CreateTestCase(testDir, CompilerOutput.PSharp);

            TestAssertions.AssertTestCase(testCasePSharp);
        }
Exemplo n.º 3
0
        public void TestRegressions(DirectoryInfo testDir)
        {
            DirectoryInfo    scratchDir     = Directory.CreateDirectory(Constants.ScratchParentDirectory);
            TestCaseFactory  factory        = new TestCaseFactory(scratchDir);
            CompilerTestCase testCaseCoyote = factory.CreateTestCase(testDir, CompilerOutput.Coyote);

            TestAssertions.AssertTestCase(testCaseCoyote);
        }
Exemplo n.º 4
0
        public void TestTimer()
        {
            DirectoryInfo tempDir =
                Directory.CreateDirectory(Path.Combine(Constants.ScratchParentDirectory, nameof(TestForeignTypes)));
            FileInfo tempFilePath = new FileInfo(Path.Combine(Constants.SolutionDirectory, "Src", "Samples", "Timer",
                                                              "TimerHeader.p"));

            CompilerTestCase testCase = new CompilerTestCase(
                tempDir,
                new CompileOnlyRunner(CompilerOutput.C, new[] { tempFilePath }),
                new CompileSuccessValidator());

            TestAssertions.AssertTestCase(testCase);
        }
Exemplo n.º 5
0
        public void TestPingPong()
        {
            DirectoryInfo tempDir =
                Directory.CreateDirectory(Path.Combine(Constants.ScratchParentDirectory, nameof(TestForeignTypes)));
            FileInfo pingPongPath = new FileInfo(Path.Combine(Constants.SolutionDirectory, "Src", "Samples", "PingPong",
                                                              "PingPong.p"));
            FileInfo prtDistPath = new FileInfo(Path.Combine(Constants.SolutionDirectory, "Src", "Samples", "PingPong",
                                                             "PrtDistHelp.p"));
            CompilerTestCase testCase = new CompilerTestCase(
                tempDir,
                new CompileOnlyRunner(CompilerOutput.C, new[] { pingPongPath, prtDistPath }),
                new CompileSuccessValidator());

            TestAssertions.AssertTestCase(testCase);
        }
Exemplo n.º 6
0
        public void TestTemp()
        {
            var tempDir      = Directory.CreateDirectory(Path.Combine(Constants.ScratchParentDirectory, "TestTemp"));
            var tempFilePath = new FileInfo(Path.Combine(Constants.SolutionDirectory, "tmp", "test.p"));
            var nativeFiles  = tempFilePath.Directory.GetFiles("*.c");

            if (!tempFilePath.Exists)
            {
                return;
            }

            var testCase = new CompilerTestCase(tempDir, new PrtRunner(new[] { tempFilePath }, nativeFiles),
                                                new ExecutionOutputValidator(0, null, null));

            TestAssertions.AssertTestCase(testCase);
        }
Exemplo n.º 7
0
        public void TestCompileCoyoteTemp()
        {
            DirectoryInfo tempDir      = Directory.CreateDirectory(Path.Combine(Constants.ScratchParentDirectory, "TestCoyoteTemp"));
            FileInfo      tempFilePath = new FileInfo(Path.Combine(Constants.SolutionDirectory, "tmp", "test.p"));

            //var foreignFilePath = new FileInfo(Path.Combine(Constants.SolutionDirectory, "tmp", "Foreign.cs"));

            if (!tempFilePath.Exists)
            {
                return;
            }

            CompilerTestCase testCase = new CompilerTestCase(
                tempDir,
                new CoyoteRunner(new[] { tempFilePath }),
                new CompileSuccessValidator());

            TestAssertions.AssertTestCase(testCase);
        }
Exemplo n.º 8
0
        public void TestModuleSystem()
        {
            var tempDir  = Directory.CreateDirectory(Path.Combine(Constants.ScratchParentDirectory, "TestPSharpTemp"));
            var allFiles = new[]
            {
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "PingPong", "Main.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "PingPong", "PingPong.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "PingPong", "Safety.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "PingPong", "Liveness.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "PingPong", "Testscript.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "Env", "Env.p")),
                new FileInfo(Path.Combine(Constants.SolutionDirectory, "Tutorial", "Timer", "Timer.p"))
            };

            var testCase = new CompilerTestCase(
                tempDir,
                new PSharpRunner(allFiles),
                new CompileSuccessValidator());

            TestAssertions.AssertTestCase(testCase);
        }
Exemplo n.º 9
0
        public void TestFailureDetector()
        {
            DirectoryInfo tempDir =
                Directory.CreateDirectory(Path.Combine(Constants.ScratchParentDirectory, nameof(TestForeignTypes)));
            FileInfo driverPath = new FileInfo(Path.Combine(Constants.SolutionDirectory, "Src", "Samples", "FailureDetector",
                                                            "Driver.p"));
            FileInfo failureDetectorPath = new FileInfo(Path.Combine(Constants.SolutionDirectory, "Src", "Samples",
                                                                     "FailureDetector",
                                                                     "FailureDetector.p"));
            FileInfo prtDistPath = new FileInfo(Path.Combine(Constants.SolutionDirectory, "Src", "Samples",
                                                             "FailureDetector",
                                                             "PrtDistHelp.p"));
            FileInfo timerPath = new FileInfo(Path.Combine(Constants.SolutionDirectory, "Src", "Samples", "Timer",
                                                           "TimerHeader.p"));
            CompilerTestCase testCase = new CompilerTestCase(
                tempDir,
                new CompileOnlyRunner(CompilerOutput.C,
                                      new[] { driverPath, failureDetectorPath, prtDistPath, timerPath }),
                new CompileSuccessValidator());

            TestAssertions.AssertTestCase(testCase);
        }