From a8225acadeb7a94db4d8bed9cd93c159df75873e Mon Sep 17 00:00:00 2001 From: dario Date: Tue, 9 Jan 2024 15:59:14 +0100 Subject: [PATCH] Finished run.py implementation, removed test case 7. --- include/sta/tasty/config.hpp | 2 +- run.py | 4 +- src/cases/case7.cpp | 79 ------------------------------------ 3 files changed, 3 insertions(+), 82 deletions(-) delete mode 100644 src/cases/case7.cpp diff --git a/include/sta/tasty/config.hpp b/include/sta/tasty/config.hpp index 73432a9..86882ee 100644 --- a/include/sta/tasty/config.hpp +++ b/include/sta/tasty/config.hpp @@ -2,6 +2,6 @@ #ifndef STA_TASTY_CONFIG_HPP #define STA_TASTY_CONFIG_HPP -#define TASTY_CASE_7 +#define TASTY_CASE_5 #endif // STA_TASTY_CONFIG_HPP diff --git a/run.py b/run.py index 39b5d8c..5efa67e 100644 --- a/run.py +++ b/run.py @@ -31,14 +31,14 @@ for case in os.listdir(path): print(colored(f'Building case { number }...', 'blue')) # Build the new project and upload it to the STM32. - out = subprocess.run([r'Tasty\flash.bat', case]) + out = subprocess.run([r'Tasty\flash.bat', 'TACOS_DEV'], stdout = subprocess.DEVNULL) # Check if the bash script was successfully executed. if out.returncode != 0: print('Building\t' + colored('[FAILED]', 'red')) continue else: - print('Building\t' + colored('[PASSED]', 'red')) + print('Building\t' + colored('[PASSED]', 'green')) print(colored(f'Running case { number }...', 'blue')) diff --git a/src/cases/case7.cpp b/src/cases/case7.cpp deleted file mode 100644 index 2609df6..0000000 --- a/src/cases/case7.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/** - * A simple testcase that checks if threads are correctly terminated after state transitions - * by creating the following threads: - * - * - DummyThread: A thread that does nothing and runs only for state 0. - * - ToggleThread: A thread that switches between states 0 and 1. - * - Supervisor: A thread which supervises the system's behavior. - * - * This test case fails if Dummy doesn't run in state 0 or runs in state 1. - */ - -#include -#ifdef TASTY_CASE_7 - -#include -#include -#include -#include -#include -#include - -namespace sta -{ - namespace tasty - { - class DummyThread : public tacos::TacosThread - { - public: - DummyThread() - : tacos::TacosThread("Dummy", osPriorityNormal) - {} - - void func() override - { - // Nothing to do here. - } - }; - - /** - * @brief Global pointer to the dummy thread. - * - */ - std::shared_ptr dummy; - - /** - * @brief Checker function that is called repeatedly by the supervisor thread. - * - */ - void checkDummy() - { - // Wait for the next state change to happen - tacos::Statemachine::stateChangeEvent.wait(tacos::EventFlags::ALL, osWaitForever); - - // Wait a little bit longer because Dummy needs time to terminate. - osDelay(10); - - // Test if dummy is only running if the state is 0. - if (tacos::getState() == 0) - { - STA_TASTY_ASSERT(dummy->isRunning()); - } - else - { - STA_TASTY_ASSERT(!dummy->isRunning()); - } - } - - void onTastyInit() - { - std::list checks = { &checkDummy }; - - dummy = tacos::addThread({0}); - tacos::addThread({0, 1}, checks); - tacos::addThread({0, 1}, 1000); - } - } -} // namespace sta - -#endif // TASTY_CASE_7