Fix 32 bit pipeline (#1430)

This commit is contained in:
Jacqueline Deans 2023-01-16 15:54:23 -06:00 committed by GitHub
parent 77fa8d78b0
commit 807161b19c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 11 deletions

View File

@ -8,7 +8,7 @@ clean: clean_test_client
TEST_CLIENT_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main -lpthread -L${TRICK_LIB_DIR} -ltrick_var_binary_parser
test_client: models/test_client/test_client.cpp
cd models/test_client; $(TRICK_CXX) test_client.cpp -o test_client $(TRICK_CXXFLAGS) -I$(TRICK_HOME)/include $(TEST_CLIENT_LIBS) -std=c++11
cd models/test_client; $(TRICK_CXX) test_client.cpp -o test_client $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -I$(TRICK_HOME)/include $(TEST_CLIENT_LIBS) -std=c++11
clean_test_client:
rm -f models/test_client/test_client

View File

@ -6,7 +6,7 @@ include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
#include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib
CFLAGS = -g -Wall -Wextra -std=c++11 $(TRICK_CXXFLAGS)
CPP_FLAGS = -g -Wall -Wextra -std=c++11 $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS)
INCLUDE_DIRS = -I${TRICK_HOME}/include
OBJDIR = obj
LIBDIR = lib
@ -27,7 +27,8 @@ test: ${LIBDIR}/${LIBNAME}
${MAKE} -C test
$(LIBOBJS): $(OBJDIR)/%.o : src/%.cc | $(OBJDIR)
$(CPP) $(CFLAGS) ${INCLUDE_DIRS} -c $< -o $@
echo $(CPP_FLAGS)
$(CPP) $(CPP_FLAGS) ${INCLUDE_DIRS} -c $< -o $@
${LIBDIR}/${LIBNAME}: ${LIBOBJS} | ${LIBDIR}
ar crs $@ ${LIBOBJS}

View File

@ -5,7 +5,7 @@
# # make clean - removes all files generated by make.
# Flags passed to the preprocessor.
CPPFLAGS += -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS} -I../include -I${TRICK_HOME}/include
CPPFLAGS += -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS} -I../include -I${TRICK_HOME}/include ${CXXFLAGS}
# TRICK_LIBS = ${TRICK_LIB_DIR}/libtrick_units.a
EXEC_LINK_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main
@ -34,4 +34,4 @@ TEST_var_binary_parser.o : TEST_var_binary_parser.cc $(OTHER_OBJECTS)
TEST_var_binary_parser : TEST_var_binary_parser.o $(OTHER_OBJECTS)
@echo 'Building TEST_var_binary_parser'
$(CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(LIBS) $(EXEC_LINK_LIBS)
$(CXX) $(TRICK_SYSTEM_LDFLAGS) $(CPPFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(LIBS) $(EXEC_LINK_LIBS)

View File

@ -795,12 +795,28 @@ TEST (BinaryParserTest, ParseUnsignedIntWrongType) {
}
TEST (BinaryParserTest, ParseLong) {
// Var variable;
// // This is hard bc
// std::vector<unsigned char> bytes = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80};
// variable.setValue(bytes, 8, TRICK_LONG, false);
// EXPECT_EQ(variable.getValue<long>(), -9151314442816847873);
Var variable;
std::vector<unsigned char> bytes = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80};
variable.setValue(bytes, 8, TRICK_LONG, false);
// apparently this can be different by platform so we need to be careful here
size_t long_size = sizeof(long);
std::vector<unsigned char> bytes;
for (int i = 0; i < long_size-1; i++) {
bytes.push_back(0x00);
}
bytes.push_back(0x80);
variable.setValue(bytes, long_size, TRICK_LONG, false);
EXPECT_EQ(variable.getValue<long>(), LONG_MIN);
EXPECT_EQ(variable.getValue<long>(), -9151314442816847873);
}
TEST (BinaryParserTest, ParseLongWrongType) {
@ -823,10 +839,17 @@ TEST (BinaryParserTest, ParseLongWrongType) {
TEST (BinaryParserTest, ParseUnsignedLong) {
Var variable;
std::vector<unsigned char> bytes = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80};
variable.setValue(bytes, 8, TRICK_UNSIGNED_LONG, false);
// apparently this can be different by platform so we need to be careful here
size_t long_size = sizeof(unsigned long);
std::vector<unsigned char> bytes;
for (int i = 0; i < long_size-1; i++) {
bytes.push_back(0xFF);
}
bytes.push_back(0x7F);
EXPECT_EQ(variable.getValue<unsigned long>(), 9295429630892703743);
variable.setValue(bytes, long_size, TRICK_UNSIGNED_LONG, false);
EXPECT_EQ(variable.getValue<unsigned long>(), LONG_MAX);
}
TEST (BinaryParserTest, ParseUnsignedLongWrongType) {