Ejemplo n.º 1
0
        public void ErrorLogClearTest()
        {
            Console.WriteLine("Starting error log clear test...");

            List <FX3ErrorLog> initialLog, log;

            initialLog = FX3.GetErrorLog();
            Console.WriteLine("Initial error log count: " + initialLog.Count.ToString());
            foreach (FX3ErrorLog logEntry in initialLog)
            {
                Console.WriteLine(logEntry.ToString());
            }
            Console.WriteLine("Clearing error log...");
            FX3.ClearErrorLog();
            log = FX3.GetErrorLog();
            Console.WriteLine("Error log count: " + log.Count.ToString());
            foreach (FX3ErrorLog logEntry in log)
            {
                Console.WriteLine(logEntry.ToString());
            }
            Assert.AreEqual(0, log.Count, "ERROR: Error log failed to clear");
            Assert.AreEqual(0, FX3.GetErrorLogCount(), "ERROR: Error log failed to clear");

            Console.WriteLine("Rebooting FX3...");
            FX3.Disconnect();
            System.Threading.Thread.Sleep(1000);
            FX3.WaitForBoard(5);
            FX3.Connect(FX3.AvailableFX3s[0]);

            Assert.AreEqual(0, log.Count, "ERROR: Error log failed to clear");
            Assert.AreEqual(0, FX3.GetErrorLogCount(), "ERROR: Error log failed to clear");
        }
Ejemplo n.º 2
0
        public void SerialNumberTest()
        {
            Console.WriteLine("Starting FX3 serial number test...");

            int exCount = 0;

            string sn = FX3.ActiveFX3SerialNumber;

            Assert.AreEqual(sn, FX3.GetTargetSerialNumber, "ERROR: Invalid target serial number");
            Assert.AreEqual(sn, FX3.ActiveFX3.SerialNumber, "ERRRO: Invalid active FX3 serial number");

            FX3.Disconnect();
            Assert.AreEqual(null, FX3.ActiveFX3SerialNumber, "ERROR: Expected null SN when board disconnected");
            try
            {
                /* This one communicates to board, should throw exception if board not connected */
                Console.WriteLine(FX3.GetTargetSerialNumber);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                exCount = 1;
            }
            Assert.AreEqual(1, exCount, "ERROR: Expected exception to be thrown");

            Assert.AreEqual(null, FX3.ActiveFX3, "ERROR: Expected null SN when board disconnected");

            FX3.WaitForBoard(5);

            FX3.Connect(sn);
            Assert.AreEqual(sn, FX3.ActiveFX3SerialNumber, "ERROR: serial number");
            Assert.AreEqual(sn, FX3.GetTargetSerialNumber, "ERROR: Invalid target serial number");
            Assert.AreEqual(sn, FX3.ActiveFX3.SerialNumber, "ERRRO: Invalid active FX3 serial number");
        }
Ejemplo n.º 3
0
        public void BootStatusTest()
        {
            Console.WriteLine("Starting boot status retrieval test...");

            string sn = FX3.ActiveFX3.SerialNumber;
            string status;

            status = FX3.GetBootStatus;
            Console.WriteLine(status);
            Assert.False(status.Contains("Not"), "ERROR: Expected firmware to be running");
            Assert.True(FX3.FX3BoardAttached, "ERROR: Expected FX3 board to be attached");

            Console.WriteLine("Disconnecting FX3...");
            FX3.Disconnect();
            Assert.IsFalse(FX3.FX3BoardAttached, "ERROR: Expected FX3 board not to be attached");
            status = FX3.GetBootStatus;
            Console.WriteLine(status);
            Assert.True(status.Contains("Not"), "ERROR: Expected firmware to not be running");

            Console.WriteLine("Re-connecting FX3...");
            FX3.WaitForBoard(5);
            FX3.Connect(sn);
            status = FX3.GetBootStatus;
            Console.WriteLine(status);
            Assert.False(status.Contains("Not"), "ERROR: Expected firmware to be running");
        }
Ejemplo n.º 4
0
        public void FirmwareLoadTest()
        {
            Console.WriteLine("Starting firmware load test...");

            const int RESET_TRIALS = 4;

            string sn = FX3.ActiveFX3.SerialNumber;

            int exCount = 0;

            for (int trial = 0; trial < RESET_TRIALS; trial++)
            {
                Console.WriteLine("Disconnecting FX3...");
                FX3.Disconnect();
                Assert.IsNull(FX3.ActiveFX3, "ERROR: Active board should be null after disconnect");
                FX3.WaitForBoard(5);
                Assert.AreEqual(1, FX3.AvailableFX3s.Count, "ERROR: Expected only 1 FX3 to be available...");
                Console.WriteLine("Connecting to FX3...");
                FX3.Connect(sn);
            }

            try
            {
                FX3.Disconnect();
                exCount = 0;
                FX3.Connect("Bad SN");
            }
            catch (Exception e)
            {
                Assert.True(e is FX3ProgrammingException, "ERROR: Expected FX3 programming exception to be thrown");
                exCount++;
            }
            Assert.AreEqual(1, exCount, "ERROR: No exception throw for connecting to invalid board");
        }
Ejemplo n.º 5
0
        public void BoardInfoTest()
        {
            Console.WriteLine("Starting FX3 board info test...");

            FX3Board startInfo = FX3.ActiveFX3;

            Console.WriteLine("Board: " + startInfo.ToString());
            Assert.IsFalse(startInfo.VerboseMode, "ERROR: FX3 firmware should not be in verbose mode");
            Console.WriteLine("Disconnecting FX3...");
            FX3.Disconnect();
            Assert.IsNull(FX3.ActiveFX3, "ERROR: Expected FX3 object to be null after disconnect");
            FX3.WaitForBoard(10);
            Console.WriteLine("Reconnecting...");
            FX3.Connect(FX3.AvailableFX3s[0]);
            Console.WriteLine("Board: " + FX3.ActiveFX3.ToString());
            Assert.AreEqual(startInfo.SerialNumber, FX3.ActiveFX3.SerialNumber, "ERROR: Invalid serial number");
            Assert.AreEqual(startInfo.FirmwareVersionNumber, FX3.ActiveFX3.FirmwareVersionNumber, "ERROR: Invalid firmware version number");
            Assert.AreEqual(startInfo.VerboseMode, FX3.ActiveFX3.VerboseMode, "ERROR: Invalid verbose mode setting");
            Assert.AreEqual(FX3.GetFX3ApiInfo.VersionNumber, FX3.ActiveFX3.FirmwareVersionNumber, "ERROR: FX3 Firmware version does not match API");

            Console.WriteLine("Testing board up-time setting...");
            Stopwatch timer = new Stopwatch();

            long startTime = FX3.ActiveFX3.Uptime;

            timer.Start();
            while (timer.ElapsedMilliseconds < 3000)
            {
                Assert.AreEqual(timer.ElapsedMilliseconds + startTime, FX3.ActiveFX3.Uptime, 50, "ERROR: Invalid FX3 Uptime");
                System.Threading.Thread.Sleep(10);
            }
        }
Ejemplo n.º 6
0
        public void BoardDetectionTest()
        {
            Console.WriteLine("Starting FX3 board detection test...");

            string sn = FX3.ActiveFX3SerialNumber;

            Assert.AreEqual(0, FX3.AvailableFX3s.Count(), "ERROR: Expected no available FX3s");
            Assert.AreEqual(1, FX3.BusyFX3s.Count(), "ERROR: Expected 1 busy FX3");
            Assert.AreEqual(sn, FX3.BusyFX3s[0], "Invalid busy FX3 SN");

            Console.WriteLine("Rebooting FX3...");
            FX3.Disconnect();
            FX3.WaitForBoard(10);
            Assert.AreEqual(1, FX3.AvailableFX3s.Count(), "ERROR: Expected 1 available FX3");
            Assert.AreEqual(sn, FX3.AvailableFX3s[0], "Invalid available FX3 SN");
            Assert.AreEqual(0, FX3.BusyFX3s.Count(), "ERROR: Expected 0 busy FX3s");

            FX3.Connect(sn);
            Assert.AreEqual(0, FX3.AvailableFX3s.Count(), "ERROR: Expected no available FX3s");
            Assert.AreEqual(1, FX3.BusyFX3s.Count(), "ERROR: Expected 1 busy FX3");
            Assert.AreEqual(sn, FX3.BusyFX3s[0], "Invalid busy FX3 SN");
        }