コード例 #1
0
        protected void SaveTCL(TCLFile tcl)
        {
            if (tcl == null)
            {
                throw new NullReferenceException(nameof(tcl));
            }

            File.WriteAllText(Path.Combine(TestOutputFolder, $"script.tcl"), tcl.ToString());
        }
コード例 #2
0
        public void SaveTCL(TCLFile tcl, string scriptName = "script.tcl")
        {
            if (tcl == null)
            {
                throw new NullReferenceException(nameof(tcl));
            }

            File.WriteAllText(Path.Combine(_vivadoProjectLocation, scriptName), tcl.ToString());
        }
コード例 #3
0
        protected void RunTCL(TCLFile tcl = null)
        {
            if (tcl != null)
            {
                SaveTCL(tcl);
            }

            if (File.Exists(pidFile))
            {
                var pid = int.Parse(File.ReadAllText(pidFile));
                // previous run was not completed, vivado may hang in there and lock files. Kill it
                var running = Process.GetProcesses().FirstOrDefault(p => p.Id == pid);
                if (running != null)
                {
                    running.Kill(true);
                }
            }

            var process = Process.Start(new ProcessStartInfo()
            {
                FileName         = "cmd.exe",
                WorkingDirectory = TestOutputFolder,
                Arguments        = $"/c vivado.bat -mode batch -source script.tcl"
            });

            File.WriteAllText(pidFile, $"{process.Id}");

            process.WaitForExit();
            Assert.AreEqual(0, process.ExitCode);

            var logFile = Path.Combine(TestOutputFolder, "vivado.log");

            if (File.Exists(logFile))
            {
                var lines = File.ReadAllLines(logFile);
                File.WriteAllLines(logFile, lines);
            }
        }