Add simple test for CI build workflow
This commit is contained in:
@@ -542,3 +542,15 @@ install (TARGETS ${DYNAMIC_LIB_NAME}
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# | TESTS |
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
add_executable (errortest ${PROJ_DIR}/test/error.cpp)
|
||||
target_link_libraries(errortest ${STATIC_LIB_NAME})
|
||||
|
||||
project (TEST)
|
||||
#add_subdirectory (test)
|
||||
enable_testing ()
|
||||
add_test (NAME MyTest COMMAND errortest)
|
||||
8
dist.sh
8
dist.sh
@@ -289,8 +289,8 @@ host_pinvoke()
|
||||
cmake -DZTS_PINVOKE=True -H. -B$BUILD_DIR -DCMAKE_BUILD_TYPE=$1
|
||||
$CMAKE --build $BUILD_DIR $BUILD_CONCURRENCY
|
||||
# Move and clean up
|
||||
mv $BUILD_DIR/bin/* $BIN_OUTPUT_DIR
|
||||
mv $BUILD_DIR/lib/* $LIB_OUTPUT_DIR
|
||||
cp -f $BUILD_DIR/bin/* $BIN_OUTPUT_DIR
|
||||
cp -f $BUILD_DIR/lib/* $LIB_OUTPUT_DIR
|
||||
clean_post_build
|
||||
}
|
||||
|
||||
@@ -320,8 +320,8 @@ host()
|
||||
$CMAKE -H. -B$BUILD_DIR -DCMAKE_BUILD_TYPE=$1
|
||||
$CMAKE --build $BUILD_DIR $BUILD_CONCURRENCY
|
||||
# Move and clean up
|
||||
mv $BUILD_DIR/bin/* $BIN_OUTPUT_DIR
|
||||
mv $BUILD_DIR/lib/* $LIB_OUTPUT_DIR
|
||||
cp -f $BUILD_DIR/bin/* $BIN_OUTPUT_DIR
|
||||
cp -f $BUILD_DIR/lib/* $LIB_OUTPUT_DIR
|
||||
clean_post_build
|
||||
}
|
||||
|
||||
|
||||
12
test/error.cpp
Normal file
12
test/error.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Demonstrate that we can compile, link, and run an application
|
||||
* with libzt and successfully get an error from the socket API.
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ZeroTierSockets.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
return zts_socket(0,0,0) != -2; // We expect -2 from an uninitialized libzt instance
|
||||
}
|
||||
Reference in New Issue
Block a user