Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions quickTest/FVMAdaptTests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TestResults
7 changes: 7 additions & 0 deletions quickTest/FVMAdaptTests/Core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.d
*.exe
*.log
*.log1
*.o
TestResults
output/
66 changes: 66 additions & 0 deletions quickTest/FVMAdaptTests/Core/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
###############################################################################
#
# Copyright 2008-2026, Mississippi State University
#
# This file is part of the Loci Framework.
#
# The Loci Framework is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The Loci Framework is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Lesser GNU General Public License for more details.
#
# You should have received a copy of the Lesser GNU General Public License
# along with the Loci Framework. If not, see <http://www.gnu.org/licenses>
#
###############################################################################

include $(LOCI_BASE)/Loci.conf
include $(LOCI_BASE)/version.conf

INCLUDES = -I../../contrib/doctest -I$(LOCI_BASE)/include
LIB_PATH = $(LOCI_BASE)/lib:$(LD_LIBRARY_PATH)
DY_PATH = $(LOCI_BASE)/lib:$(DYLD_LIBRARY_PATH)
SOURCES = test_fvmadapt_core.cc fixtures.cc core_utils.cc plan_checks.cc \
replay_trace.cc example_artifacts.cc
OBJS = $(SOURCES:.cc=.o)

.PHONY: default examples list clean distclean FRC

default: TestResults

TestResults: test_fvmadapt_core.exe FRC
@(LD_LIBRARY_PATH=$(LIB_PATH) DYLD_LIBRARY_PATH=$(DY_PATH) ./test_fvmadapt_core.exe --check-only > test_fvmadapt_core.log || true)
@tail -n 1 test_fvmadapt_core.log > test_fvmadapt_core.log1
@echo -n FVMAdaptTests/Core/test_fvmadapt_core":" > $@
@if grep -q "SUCCESS!" test_fvmadapt_core.log1 ; then echo " PASSED!"; else echo " FAILED!"; fi >>$@
@rm test_fvmadapt_core.log1
@cat $@

examples: test_fvmadapt_core.exe
@rm -fr output
@mkdir -p output
LD_LIBRARY_PATH=$(LIB_PATH) DYLD_LIBRARY_PATH=$(DY_PATH) ./test_fvmadapt_core.exe --write-dir output

list: test_fvmadapt_core.exe
LD_LIBRARY_PATH=$(LIB_PATH) DYLD_LIBRARY_PATH=$(DY_PATH) ./test_fvmadapt_core.exe --list

test_fvmadapt_core.exe: $(OBJS) $(LOCI_BASE)/lib/libfvmadaptfunc.$(LIB_SUFFIX)
$(LD) -o $@ $(OBJS) -L$(LOCI_BASE)/lib -lfvmadaptfunc $(LIBS) $(LDFLAGS)

clean:
rm -fr *.o *.exe *.d *.log *.log1 TestResults output

distclean: clean

FRC:

DEPEND_FILES=$(SOURCES:.cc=.d)

ifeq ($(filter $(MAKECMDGOALS),clean distclean ),)
-include $(DEPEND_FILES)
endif
63 changes: 63 additions & 0 deletions quickTest/FVMAdaptTests/Core/core_utils.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//#############################################################################
//#
//# Copyright 2008-2026, Mississippi State University
//#
//# This file is part of the Loci Framework.
//#
//# The Loci Framework is free software: you can redistribute it and/or modify
//# it under the terms of the Lesser GNU General Public License as published by
//# the Free Software Foundation, either version 3 of the License, or
//# (at your option) any later version.
//#
//# The Loci Framework is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# Lesser GNU General Public License for more details.
//#
//# You should have received a copy of the Lesser GNU General Public License
//# along with the Loci Framework. If not, see <http://www.gnu.org/licenses>
//#
//#############################################################################

#include "fvmadapt_core.h"

#include <cerrno>
#include <cstring>
#include <sys/stat.h>

/// Format split-plan char codes as a readable integer list.
std::string plan_string(const std::vector<char>& plan) {
std::ostringstream out ;
out << "[" ;
for(size_t i = 0; i < plan.size(); ++i) {
if(i != 0) {
out << "," ;
}
out << int(plan[i]) ;
}
out << "]" ;
return out.str() ;
}

/// Create an output directory if it does not already exist.
void make_directory(const std::string& path) {
if(path.empty()) {
return ;
}
if(mkdir(path.c_str(), 0775) != 0 && errno != EEXIST) {
std::ostringstream msg ;
msg << "could not create directory '" << path << "': " << std::strerror(errno) ;
throw std::runtime_error(msg.str()) ;
}
}

/// Join a directory and file name with one path separator.
std::string join_path(const std::string& dir, const std::string& file) {
if(dir.empty()) {
return file ;
}
if(dir[dir.size() - 1] == '/') {
return dir + file ;
}
return dir + "/" + file ;
}
Loading