mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2026-11-25 13:11:36 +00:00
- an ASSERT_* between thread start and join() returned with a joinable std::thread, and its destructor called std::terminate() - the PluginServices fixture ended the device only from Idle; after a failure in another state, the join waited until the ctest timeout - use StateMachineThread in the Transitions tests and in the fixture, and JoiningThread in Region.LockOrder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
/********************************************************************************
|
|
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
|
* *
|
|
* This software is distributed under the terms of the *
|
|
* GNU Lesser General Public Licence (LGPL) version 3, *
|
|
* copied verbatim in the file "LICENSE" *
|
|
********************************************************************************/
|
|
|
|
#include "../helper/ControlDevice.h"
|
|
|
|
#include <fairmq/Device.h>
|
|
#include <fairlogger/Logger.h>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <system_error>
|
|
|
|
namespace
|
|
{
|
|
|
|
using namespace std;
|
|
using namespace fair::mq;
|
|
|
|
TEST(Transitions, InvalidChangeState)
|
|
{
|
|
Device device;
|
|
test::StateMachineThread t(device);
|
|
|
|
ASSERT_FALSE(device.ChangeState(Transition::Connect));
|
|
|
|
ASSERT_TRUE(device.ChangeState(Transition::End));
|
|
t.Join();
|
|
}
|
|
|
|
TEST(Transitions, InvalidChangeStateOrThrow)
|
|
{
|
|
Device device;
|
|
test::StateMachineThread t(device);
|
|
|
|
ASSERT_THROW(device.ChangeStateOrThrow(Transition::Connect), std::system_error);
|
|
|
|
ASSERT_NO_THROW(device.ChangeStateOrThrow(Transition::End));
|
|
t.Join();
|
|
}
|
|
|
|
} // namespace
|