mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/Tasty.git
synced 2025-06-12 03:25:58 +00:00
Finished run.py implementation, removed test case 7.
This commit is contained in:
parent
adc37233ab
commit
a8225acade
@ -2,6 +2,6 @@
|
|||||||
#ifndef STA_TASTY_CONFIG_HPP
|
#ifndef STA_TASTY_CONFIG_HPP
|
||||||
#define STA_TASTY_CONFIG_HPP
|
#define STA_TASTY_CONFIG_HPP
|
||||||
|
|
||||||
#define TASTY_CASE_7
|
#define TASTY_CASE_5
|
||||||
|
|
||||||
#endif // STA_TASTY_CONFIG_HPP
|
#endif // STA_TASTY_CONFIG_HPP
|
||||||
|
4
run.py
4
run.py
@ -31,14 +31,14 @@ for case in os.listdir(path):
|
|||||||
print(colored(f'Building case { number }...', 'blue'))
|
print(colored(f'Building case { number }...', 'blue'))
|
||||||
|
|
||||||
# Build the new project and upload it to the STM32.
|
# 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.
|
# Check if the bash script was successfully executed.
|
||||||
if out.returncode != 0:
|
if out.returncode != 0:
|
||||||
print('Building\t' + colored('[FAILED]', 'red'))
|
print('Building\t' + colored('[FAILED]', 'red'))
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
print('Building\t' + colored('[PASSED]', 'red'))
|
print('Building\t' + colored('[PASSED]', 'green'))
|
||||||
|
|
||||||
print(colored(f'Running case { number }...', 'blue'))
|
print(colored(f'Running case { number }...', 'blue'))
|
||||||
|
|
||||||
|
@ -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 <sta/tasty/config.hpp>
|
|
||||||
#ifdef TASTY_CASE_7
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <sta/tacos.hpp>
|
|
||||||
#include <sta/debug/debug.hpp>
|
|
||||||
#include <sta/tasty/utils.hpp>
|
|
||||||
#include <sta/tasty/tasks/toggle.hpp>
|
|
||||||
#include <sta/tasty/tasks/supervisor.hpp>
|
|
||||||
|
|
||||||
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<DummyThread> 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<TastyCheck> checks = { &checkDummy };
|
|
||||||
|
|
||||||
dummy = tacos::addThread<DummyThread>({0});
|
|
||||||
tacos::addThread<Supervisor>({0, 1}, checks);
|
|
||||||
tacos::addThread<ToggleThread>({0, 1}, 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // namespace sta
|
|
||||||
|
|
||||||
#endif // TASTY_CASE_7
|
|
Loading…
x
Reference in New Issue
Block a user