-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
port for QNX7.1/8.0 #1446
Open
pkleymonov-qnx
wants to merge
3
commits into
chriskohlhoff:master
Choose a base branch
from
pkleymonov-qnx:port_for_qnx
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
port for QNX7.1/8.0 #1446
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# QNX Build Files | ||
build/nto-aarch64-le/* | ||
build/nto-x86_64-o/* | ||
!build/Makefile | ||
!build/nto-aarch64-le/GNUmakefile | ||
!build/nto-x86_64-o/GNUmakefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Compile the port for QNX | ||
|
||
**NOTE**: QNX ports are only supported from a **Linux host** operating system | ||
|
||
### Install dependencies | ||
|
||
`sudo apt install automake` | ||
|
||
`sudo apt install pkg-config` | ||
|
||
### Switch to asio main folder | ||
|
||
`cd asio` | ||
|
||
### Generate GNU build tool ./configure and all needed Makefiles | ||
|
||
`./autogen.sh` | ||
|
||
### Setup QNX SDP environment | ||
|
||
`source <path-to-sdp>/qnxsdp-env.sh` | ||
|
||
### Build examples and install asio headers into SDP | ||
|
||
`JLEVEL=$(nproc) make -C qnx/build install` | ||
|
||
|
||
**All asio headers have to be installed to SDP** | ||
* $QNX_TARGET/usr/include/asio/ | ||
* $QNX_TARGET/usr/include/asio.hpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
LIST=OS CPU VARIANT | ||
MAKEFILE=GNUmakefile | ||
include recurse.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# QNX specific build configuration nested level | ||
# | ||
NESTED_LEVEL="../../.." | ||
|
||
# | ||
# Setup of essential configuration parameters | ||
# | ||
function hook_preconfigure { | ||
# | ||
# QNX specific changes are covered by prediefined '__QNX__' | ||
# For examples: "fd_passing_stream_server" and "fd_passing_stream_client" | ||
# For the testsuites: unit/ip/multicast | ||
# | ||
CXXFLAGS="$CXXFLAGS -DASIO_HAS_PTHREADS -DASIO_HAS_STD_STRING_VIEW -DASIO_HAS_CONSTEXPR -DASIO_HAS_STD_FUTURE_CLASS" | ||
|
||
# | ||
# Add socket library | ||
# | ||
LDFLAGS="$LDFLAGS -lsocket" | ||
|
||
# | ||
# Distributive directory | ||
# | ||
DIST_BASE="${PWD}/${NESTED_LEVEL}" | ||
|
||
# | ||
# Setup correct pathes for install and build make commands | ||
# | ||
configure_opts="--srcdir=${DIST_BASE}" | ||
configure_opts="${configure_opts} --prefix=${INSTALL_ROOT_nto}/usr" | ||
configure_opts="${configure_opts} --exec-prefix=${INSTALL_ROOT_nto}/${cpudir}/usr" | ||
} | ||
|
||
# | ||
# Adjust relative path to ./configure tool | ||
# | ||
function hook_configure { | ||
${NESTED_LEVEL}/configure \ | ||
${ac_host:+"--host=${ac_host}"} \ | ||
${ac_build:+"--build=${ac_build}"} \ | ||
${configure_opts} \ | ||
${ac_params:+${CC:+"CC=${CC}"}} \ | ||
${ac_params:+${CFLAGS:+"CFLAGS=-O2 ${CFLAGS}"}} \ | ||
${ac_params:+${CPPFLAGS:+"CPPFLAGS=${CPPFLAGS}"}} \ | ||
${ac_params:+${LDFLAGS:+"LDFLAGS=${LDFLAGS}"}} \ | ||
${ac_params:+${CXX:+"CXX=${CXX}"}} \ | ||
${ac_params:+${CXXFLAGS:+"CXXFLAGS=-O2 ${CXXFLAGS}"}} \ | ||
${ac_params:+${ac_autotools:+${ac_autotools}}} \ | ||
|| Error "configure failed"; | ||
} | ||
|
||
function hook_premake { | ||
if [ "${make_cmds}" == "check" ] && [ "${TARGET_SYSNAME}" == "nto" ]; then | ||
echo "For target nto suppress tests execution." | ||
echo "All tests have to be run on target system." | ||
make_opts="${make_opts} TESTS=''" | ||
fi | ||
} | ||
|
||
function hook_postmake { | ||
red="\033[0;31m" | ||
grn="\033[0;32m" | ||
yel="\033[1;33m" | ||
blu="\033[1;34m" | ||
cls="\033[0m" | ||
base_build=$PWD | ||
base_testsuite="src/tests" | ||
base_script="run_testsuites.sh" | ||
testsuite_log="test-suite.log" | ||
testsuite_script=$base_testsuite/$base_script | ||
testsuite_sdp_bin=${INSTALL_ROOT_nto}/${cpudir}/usr/bin/asio_tests | ||
|
||
# | ||
# uninstall all asio test from SDP | ||
# | ||
if [ "${make_cmds}" == "uninstall" ] && [ -d ${testsuite_sdp_bin} ]; then | ||
echo "we have to uninstall all asio tests" | ||
(set -x; rm -rf ${testsuite_sdp_bin}) | ||
fi | ||
|
||
# | ||
# build and install all asio tests | ||
# | ||
if [ "${make_cmds}" == "check" ] && [ "${TARGET_SYSNAME}" == "nto" ] && [ "${SYSNAME}" == "linux" ]; then | ||
if [ -d ${base_testsuite} ]; then | ||
|
||
echo "${blu}=========================================================================${cls}" | ||
echo "${blu}Generate script to run testsuites for the ${cpu}${cls}" | ||
echo "${blu}=========================================================================${cls}" | ||
|
||
echo "Remove old testsuite script ..." | ||
#(set -x; <command> - print each command before executing ) | ||
(set -x; rm -f "$testsuite_script") | ||
|
||
echo "Looking for tests executables..." | ||
testsuite_list=$(find . -type f -executable | sed -n "s/^\.\/src\/tests\/\(\S*\)$/\1/p") | ||
|
||
pkg_str=$(grep 'PACKAGE_STRING' Makefile | grep -oP '\d+\.\d+\.\d+' | head -1) | ||
|
||
echo "Creating testsuites script..." | ||
echo "#!/bin/sh" > $testsuite_script || Error "Unexpected error during $testsuite_script initialization"; | ||
echo "_pass=0" >> $testsuite_script || Error "Unexpected error during $testsuite_script initialization"; | ||
echo "_fail=0" >> $testsuite_script || Error "Unexpected error during $testsuite_script initialization"; | ||
echo "echo \"### Testsuites log file ###\" > $testsuite_log" >> $testsuite_script || Error "Unexpected error during $testsuite_script initialization"; | ||
|
||
|
||
echo "Adding testsuites to the script:'$testsuite_script'..." | ||
testsuite_number=0 | ||
for v in ${testsuite_list}; do | ||
testsuite_number=$((testsuite_number+1)); | ||
echo "### Suite number: $testsuite_number" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo "result=\$($v 2>&1)" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo "if [ 0 -eq \$? ]; then" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo " _pass=\$((_pass+1))" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo " echo \"${grn}PASS${cls}:$v\"" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo "else" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo " _fail=\$((_fail+1))" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo " echo \"${red}FAIL${cls}:$v\"" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo "fi" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo "echo \"### Testsuite:$v ###\" >> $testsuite_log" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo "echo \"\${result}\" >> $testsuite_log" >> $testsuite_script || Error "Unexpected error during $testsuite_script update by testsuite:'$v'"; | ||
echo "${blu}ADDED${cls}:$v"; | ||
# | ||
# install testsuite into SDP | ||
# | ||
_dest_folder="${testsuite_sdp_bin}/$(dirname $v)" | ||
_source_test="src/tests/$v" | ||
[ -d "${_dest_folder}" ] || (set -x; mkdir -p ${_dest_folder}) | ||
(set -x; cp -f $_source_test $_dest_folder) | ||
done | ||
|
||
echo "echo \"${grn}=========================================================================${cls}\"" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
echo "echo \"${grn}Testsuite summary for asio ${pkg_str}${cls}\"" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
echo "echo \"${grn}=========================================================================${cls}\"" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
echo "echo \"# TOTAL: ${testsuite_number}\"" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
echo "echo \"# ${grn}PASS${cls}: \${_pass}\"" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
echo "echo \"# ${red}FAIL${cls}: \${_fail}\"" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
echo "if [ 0 -eq \${_fail} ]; then" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
echo "echo \"${grn}=========================================================================${cls}\"" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
echo "else" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
echo "echo \"${red}\${_fail} fails see test log:$testsuite_log ${cls}\"" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
echo "fi" >> $testsuite_script || Error "Unexpected error during $testsuite_script update"; | ||
|
||
chmod +x $testsuite_script | ||
|
||
#(set -x; <command> - print each command before executing ) | ||
(set -x; cp -f $testsuite_script $testsuite_sdp_bin) | ||
|
||
echo "${blu}For asio ${pkg_str} total ${testsuite_number} testsuites were added into script:${testsuite_script}${cls}"; | ||
echo "${blu}All testsuites were installed into '${testsuite_sdp_bin}'${cls}"; | ||
echo "${blu}To run all tests please copy '${testsuite_sdp_bin}' to the target system and run test script '${testsuite_script}'${cls}"; | ||
else | ||
echo "${red}Error - base testsuite:'${base_build}/${base_testsuite}' for asio ${pkg_str} was not found!${cls}"; | ||
exit 1; | ||
fi | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ifndef QCONFIG | ||
QCONFIG=qconfig.mk | ||
endif | ||
include $(QCONFIG) | ||
|
||
include $(MKFILES_ROOT)/qmake-cfg.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ifndef QCONFIG | ||
QCONFIG=qconfig.mk | ||
endif | ||
include $(QCONFIG) | ||
|
||
include $(MKFILES_ROOT)/qmake-cfg.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Testing asio lib on QNX | ||
|
||
**NOTE**: QNX ports are only supported from a **Linux host** operating system | ||
|
||
asio lib normally wants to be tested on the same machine it was built on. This obviously doesn't work when cross-compiling for QNX. The gist is to build, then copy the whole asio lib source tree on a target. This will include all the relevant files and directory structure which asio lib expects when running its test suite. | ||
|
||
# Running the Test Suite | ||
|
||
### Install dependencies | ||
|
||
`sudo apt install automake` | ||
|
||
`sudo apt install pkg-config` | ||
|
||
### Switch to asio main folder | ||
|
||
`cd asio` | ||
|
||
### Generate GNU build tool ./configure and all needed Makefiles | ||
|
||
`./autogen.sh` | ||
|
||
### Setup QNX SDP environment | ||
|
||
`source <path-to-sdp>/qnxsdp-env.sh` | ||
|
||
### Build and install all asio tests into SDP | ||
|
||
`JLEVEL=$(nproc) CPULIST=x86_64 make -C qnx/build check` | ||
|
||
### Then build your QNX image using mkqnximage and the following options: | ||
|
||
`export ASIO_ROOT=$PWD` | ||
|
||
`mkdir test_image && cd test_image` | ||
|
||
`mkqnximage --extra-dirs=$ASIO_ROOT/qnx/test/mkqnximage --clean --run --force --test-asio=$QNX_TARGET/x86_64/usr/bin/asio_tests` | ||
|
||
### Once the target has booted, the asio tests will be located in /data/asio: | ||
|
||
`cd /data/asio` | ||
|
||
`./run_testsuites.sh` | ||
|
||
### Test execution summary | ||
`...` | ||
|
||
`=========================================================================` | ||
|
||
`Testsuite summary for asio 1.29.0` | ||
|
||
`=========================================================================` | ||
|
||
`# TOTAL: 346` | ||
|
||
`# PASS: 346` | ||
|
||
`# FAIL: 0` | ||
|
||
`=========================================================================` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"All Rights Reserved" isn't going to fly with the Boost Software License.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done