forked from nasa/fprime
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding FppTest for overflow: drop, assert, hook
- Loading branch information
Showing
18 changed files
with
224 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
output port enumArgsHookOverflowed: [2] EnumArgs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// ====================================================================== | ||
// \title TimeTests.cpp | ||
// \author T. Chieu | ||
// \brief cpp file for time tests | ||
// | ||
// \copyright | ||
// Copyright (C) 2009-2023 California Institute of Technology. | ||
// ALL RIGHTS RESERVED. United States Government Sponsorship | ||
// acknowledged. | ||
// | ||
// ====================================================================== | ||
|
||
#include "Fw/Time/Time.hpp" | ||
#include "STest/Pick/Pick.hpp" | ||
#include "Tester.hpp" | ||
|
||
// ---------------------------------------------------------------------- | ||
// Overflow assert test | ||
// ---------------------------------------------------------------------- | ||
|
||
void Tester ::testOverflowAssert() { | ||
FormalParamEnum x = FormalParamEnum::T::X; | ||
FormalParamEnum y = FormalParamEnum::T::Y; | ||
FormalParamEnum z = FormalParamEnum::T::Z; | ||
|
||
for (FwSizeType i = 0; i < Tester::TEST_INSTANCE_QUEUE_DEPTH; i++) { | ||
this->invoke_to_enumArgsAsync(i % 2, x, y); | ||
} | ||
ASSERT_DEATH_IF_SUPPORTED(this->invoke_to_enumArgsAsync(0, y, z), ""); | ||
} | ||
|
||
// ---------------------------------------------------------------------- | ||
// Overflow drop test | ||
// ---------------------------------------------------------------------- | ||
|
||
void Tester ::testOverflowDrop() { | ||
FormalParamStruct x; | ||
FormalParamStruct y; | ||
FormalParamStruct z; | ||
for (FwSizeType i = 0; i < Tester::TEST_INSTANCE_QUEUE_DEPTH; i++) { | ||
this->invoke_to_structArgsAsync(i % 2, x, y); | ||
} | ||
// This will overflow and should not crash | ||
this->invoke_to_structArgsAsync(0, y, z); | ||
} | ||
|
||
// ---------------------------------------------------------------------- | ||
// Overflow hook test | ||
// ---------------------------------------------------------------------- | ||
|
||
void Tester ::testOverflowHook() { | ||
FormalParamEnum x = FormalParamEnum::T::X; | ||
FormalParamEnum y = FormalParamEnum::T::Y; | ||
FormalParamEnum z = FormalParamEnum::T::Z; | ||
|
||
for (FwSizeType i = 0; i < Tester::TEST_INSTANCE_QUEUE_DEPTH; i++) { | ||
this->invoke_to_enumArgsHook(i % 2, x, y); | ||
} | ||
this->invoke_to_enumArgsHook(0, y, z); | ||
this->invoke_to_enumArgsHook(1, z, x); | ||
ASSERT_from_enumArgsHookOverflowed_SIZE(2); | ||
ASSERT_from_enumArgsHookOverflowed(0, y, z); | ||
ASSERT_from_enumArgsHookOverflowed(1, z, x); | ||
|
||
} | ||
|
||
// ---------------------------------------------------------------------- | ||
// Handler to support overflow hook test | ||
// ---------------------------------------------------------------------- | ||
|
||
void Tester ::from_enumArgsHookOverflowed_handler(const NATIVE_INT_TYPE portNum, | ||
const FormalParamEnum& en, | ||
FormalParamEnum& enRef) { | ||
this->pushFromPortEntry_enumArgsHookOverflowed(en, enRef); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; Ref requires no specific settings thus the [fprime] configuration block is empty | ||
; For more information: https://nasa.github.io/fprime/UsersGuide/user/settings.html | ||
[fprime] | ||
framework_path: .. | ||
default_cmake_options: FPRIME_SKIP_TOOLS_VERSION_CHECK=ON FPRIME_ENABLE_FRAMEWORK_UTS=OFF FPRIME_ENABLE_AUTOCODER_UTS=OFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters