Skip to content

Commit

Permalink
Fix header paths in test impl code
Browse files Browse the repository at this point in the history
Update unit tests
  • Loading branch information
bocchino committed Nov 29, 2023
1 parent 4ff4235 commit 68753f7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ case class ComponentImplWriter(
val path = s.removeLongestPathPrefix(fullPath)
val userHeaders = List(
"FpConfig.hpp",
s"${path}.hpp"
s"$path.hpp"
)
linesMember(
addBlankPrefix(userHeaders.sorted.map(CppWriter.headerString).map(line)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ case class ComponentTestImplWriter(
}

private def getHppIncludes: CppDoc.Member = {
def getHeaderPath(fileName: String): String = {
val loc = symbol.getLoc.tuLocation
val fullPath = loc.getNeighborPath(fileName)
s"${s.removeLongestPathPrefix(fullPath)}.hpp"
}
val headers = List(
s"${s.getRelativePath(ComputeCppFiles.FileNames.getComponentGTestBase(name))}.hpp",
s"${s.getRelativePath(ComputeCppFiles.FileNames.getComponentImpl(name))}.hpp"
)
ComputeCppFiles.FileNames.getComponentGTestBase(name),
ComputeCppFiles.FileNames.getComponentImpl(name)
).map(getHeaderPath)
linesMember(
addBlankPrefix(headers.map(CppWriter.headerString).map(line))
)
Expand Down
2 changes: 1 addition & 1 deletion compiler/tools/fpp-to-cpp/test/component/impl/check-cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ do
cp $base.template.ref.hpp $base.hpp
cp $base.template.ref.cpp $base.cpp
echo "compiling $base.cpp"
$fprime_gcc -I../../../.. -I.. -c $base.cpp $warning_flags
$fprime_gcc -I../../../.. -c $base.cpp $warning_flags
done
8 changes: 4 additions & 4 deletions compiler/tools/fpp-to-cpp/test/component/test-impl/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ empty()
{
# Run the empty test in auto setup mode
# This tests auto setup
run_test "-a -u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../empty" empty && \
run_test "-a -u -t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../empty" empty && \
diff_test_template Empty
}

passive()
{
run_test "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../passive" passive && \
run_test "-u -t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../passive" passive && \
diff_test_template PassiveCommands && \
diff_test_template PassiveEvents && \
diff_test_template PassiveGetProductPortsOnly && \
Expand All @@ -27,7 +27,7 @@ passive()

active()
{
run_test "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../active" active && \
run_test "-u -t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../active" active && \
diff_test_template ActiveAsyncProductPortsOnly && \
diff_test_template ActiveAsyncProducts && \
diff_test_template ActiveCommands && \
Expand All @@ -43,7 +43,7 @@ active()

queued()
{
run_test "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../queued" queued && \
run_test "-u -t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../queued" queued && \
diff_test_template QueuedTest && \
diff_test_template QueuedSerial && \
diff_test_template QueuedCommands && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ empty()
{
# Run the empty test in auto setup mode
# This tests auto setup
update "-a -u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../empty" empty
update "-a -u -t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../empty" empty
move_test_template Empty
}

passive()
{
update "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../passive" passive
update "-u -t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../passive" passive
move_test_template PassiveCommands
move_test_template PassiveEvents
move_test_template PassiveGetProductPortsOnly
Expand All @@ -27,7 +27,7 @@ passive()

active()
{
update "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../active" active
update "-u -t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../active" active
move_test_template ActiveAsyncProductPortsOnly
move_test_template ActiveAsyncProducts
move_test_template ActiveCommands
Expand All @@ -43,7 +43,7 @@ active()

queued()
{
update "-u -t -i `cat ../deps-comma.txt`" "-p $PWD,$fprime_dir ../queued" queued
update "-u -t -i `cat ../deps-comma.txt`" "-p $component_dir,$fprime_dir ../queued" queued
move_test_template QueuedCommands
move_test_template QueuedEvents
move_test_template QueuedGetProducts
Expand Down

0 comments on commit 68753f7

Please sign in to comment.