Skip to content

Commit

Permalink
[ci] streamlining
Browse files Browse the repository at this point in the history
  • Loading branch information
pattacini committed Apr 19, 2023
1 parent 0f7c0b4 commit ac7eaed
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dry-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
shell: bash
run: |
cd build
cmake --build . --target install
cmake --build . --config Release --target install
- name: Test
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build products
/build*/
build*

# System hidden files
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ tasks:
-DCMAKE_INSTALL_PREFIX=${DEPENDENCIES_DIR}/install \
-DBUILD_TESTING:BOOL=ON \
-DINSTALL_ALL_ROBOTS:BOOL=ON
cmake --build . --target install
cmake --build . --config Release --target install
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
# Authors: Ugo Pattacini
# CopyPolicy: Released under the terms of the GNU GPL v2.0.

cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.12)
project(robots-configuration VERSION 2.2.1)

find_package(YCM REQUIRED)
find_package(YARP REQUIRED)
find_package(ICUBcontrib REQUIRED)

list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${ICUBCONTRIB_MODULE_PATH})

include(YarpInstallationHelpers)
include(ICUBcontribOptions)
include(ICUBcontribHelpers)

Expand All @@ -25,6 +23,9 @@ if(UNIX)
find_program(BASH_PROGRAM bash)
include(CTest)
enable_testing()
if(BUILD_TESTING)
add_subdirectory(tests/dry-run/check-nws-nwc-xml)
endif()
endif()

if(INSTALL_ALL_ROBOTS)
Expand All @@ -49,7 +50,7 @@ if(INSTALL_ALL_ROBOTS)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/CMakeLists.txt)
message(STATUS "Exists")
add_subdirectory(${dir})
if(BASH_PROGRAM)
if(BUILD_TESTING AND BASH_PROGRAM)
set(test_dryrun_xml_name "dry-run_${dir}_xml")
add_test(NAME ${test_dryrun_xml_name} COMMAND ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/tests/dry-run/dry-run_xml.sh ${dir})
message(STATUS "Also added test ${test_dryrun_xml_name}")
Expand Down
2 changes: 1 addition & 1 deletion tests/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV DEBIAN_FRONTEND=noninteractive
# Install essentials
RUN apt update && \
apt install -y sudo apt-utils apt-transport-https software-properties-common build-essential psmisc procps gdb gdebi autoconf locales \
git gitk cmake libace-dev libtinyxml-dev libtinyxml2-dev libxml2-dev \
git gitk cmake libace-dev libtinyxml-dev libtinyxml2-dev libxml2-dev libxml2-utils \
coinor-libipopt-dev libeigen3-dev libgsl-dev libopencv-dev libsdl1.2-dev \
libi2c-dev i2c-tools xmlstarlet magic-wormhole

Expand Down
9 changes: 4 additions & 5 deletions tests/dry-run/check-nws-nwc-xml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ cmake_minimum_required(VERSION 3.12)
project(check-nws-nwc-xml)

include(FetchContent)

FetchContent_Declare(
pugixml
GIT_REPOSITORY https://github.com/zeux/pugixml.git
GIT_TAG origin/master
)

FetchContent_GetProperties(pugixml)
if(NOT pugixml)
FetchContent_Populate(pugixml)
add_subdirectory(${pugixml_SOURCE_DIR} ${pugixml_BINARY_DIR})
endif()
if(NOT pugixml)
FetchContent_Populate(pugixml)
add_subdirectory(${pugixml_SOURCE_DIR} ${pugixml_BINARY_DIR})
endif()

add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE check-nws-nwc-xml.cpp)
Expand Down
20 changes: 8 additions & 12 deletions tests/dry-run/check-nws-nwc-xml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,27 @@ sudo apt install libxml2-utils
2. Build the code :

```sh
cd <your-robots-configuration-folder>/experimentalSetups/check-nws-nwc-xml
mkdir build
cd build
ccmake ..
make
cd <your-robots-configuration-folder>/tests/dry-run/check-nws-nwc-xml
mkdir build && cd build
cmake ..
make install
```

3. Run the program :

```sh
cd <your-robots-configuration-folder>/experimentalSetups/check-nws-nwc-xml/build
./check-nws-nwc-xml <robot-folder-absolute-path>
check-nws-nwc-xml <robot-folder-absolute-path>
```
## Example

Run :
Example:

```sh
./check-nws-nwc-xml /home/tumme/icub-tech-iit/robots-configuration/iCubLausanne01/
check-nws-nwc-xml /home/tumme/icub-tech-iit/robots-configuration/iCubLausanne01/
```

Output :

```
```console
1 - test yarprobotinterface.ini presence **************

yarprobotinterface.ini FOUND! PASS
Expand Down Expand Up @@ -200,5 +197,4 @@ Remappers XSD check passed!
***************************************************

ALL TESTS PASSED!!
```
8 changes: 4 additions & 4 deletions tests/dry-run/check-nws-nwc-xml/check-nws-nwc-xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ int main(int argc, char *argv[])
if(ele.find("calibrators") != std::string::npos) {
found = true;
std::cout << ele << std::endl;
xsd_cmd = "xmllint --schema ..\/calibrators.xsd " + ele + " --noout";
xsd_cmd = "xmllint --schema ../calibrators.xsd " + ele + " --noout";
ret = system(xsd_cmd.c_str());
if (WEXITSTATUS(ret) != 0) {
ALL_PASSED = false;
Expand All @@ -293,7 +293,7 @@ int main(int argc, char *argv[])
if(ele.find("cartesian") != std::string::npos) {
found = true;
std::cout << ele << std::endl;
xsd_cmd = "xmllint --schema ..\/cartesian.xsd " + ele + " --noout";
xsd_cmd = "xmllint --schema ../cartesian.xsd " + ele + " --noout";
ret = system(xsd_cmd.c_str());
if (WEXITSTATUS(ret) != 0) {
ALL_PASSED = false;
Expand All @@ -319,7 +319,7 @@ int main(int argc, char *argv[])
if(ele.find("wrappers/motorControl") != std::string::npos && ele.find("_wrapper") != std::string::npos) {
found = true;
std::cout << ele << std::endl;
xsd_cmd = "xmllint --schema ..\/wrapper.xsd " + ele + " --noout";
xsd_cmd = "xmllint --schema ../wrapper.xsd " + ele + " --noout";
ret = system(xsd_cmd.c_str());
if (WEXITSTATUS(ret) != 0) {
ALL_PASSED = false;
Expand All @@ -345,7 +345,7 @@ int main(int argc, char *argv[])
if(ele.find("wrappers/motorControl") != std::string::npos && ele.find("_remapper") != std::string::npos) {
found = true;
std::cout << ele << std::endl;
xsd_cmd = "xmllint --schema ..\/remapper.xsd " + ele + " --noout";
xsd_cmd = "xmllint --schema ../remapper.xsd " + ele + " --noout";
ret = system(xsd_cmd.c_str());
if (WEXITSTATUS(ret) != 0) {
ALL_PASSED = false;
Expand Down

0 comments on commit ac7eaed

Please sign in to comment.