2
0
mirror of https://github.com/boostorg/process.git synced 2026-01-19 04:22:15 +00:00

Drone & Multple fix (#250)

Squash after invalid branch & merge conflict.

* Fixed file_descriptor move assignment operator to return a reference to 'this'. Issue # 219

* Returning *this instead of erroneous *this. Issue # 219

* Removed unneeded WNOHANG.

* Closes boostorg/process#190

* Closes boostorg/process#121

* Attempting to fix wchar_t build error on circle.

* Closes boostorg/process#197.

* Changed child(pid_t) signature.

* Multiple fixes.

* Closes boostorg/process#189.

* Closes boostorg/process#191.

* Added missing work guard on windows.

* Trying to catch windows early complete.

* Increased log level on windows.

* Multiple windows test fixes

* Removed overly constraint tests.

* fix missing headers

* Closes klemens-morgenstern/boost-process#218

* Update executor.hpp

explicit cast to int to silence this: `error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'int' in initializer list [-Wc++11-narrowing]`

* Fix posix implementation of move constructor/assignment in file_descriptor

* Adjust docs `@boost` relative paths

* Fixed UB for large environment names.

* Closes boostorg/process#207.

* Drone setup

* Added include for filesystem::fstream.

* Disabled useless tests.

* Fixed environment length checks.

* Pipe test & warning fixes.

* Disabled warnings & added windows include fix.

* More test fixes.

* Removed some tests from apple build.

* Removed some tests from apple build.

* Disabled OSX tests via build script & fixed windows examples.

* TSA fix attempt.

Co-authored-by: James Baker <james.baker@bullochtech.com>
Co-authored-by: silent <silent@symica.com>
Co-authored-by: ikrijan <62850248+ikrijan@users.noreply.github.com>
Co-authored-by: Shauren <shauren.trinity@gmail.com>
Co-authored-by: alandefreitas <alandefreitas@gmail.com>
This commit is contained in:
Klemens Morgenstern
2022-05-19 17:00:15 +08:00
committed by GitHub
parent bbb7dced5c
commit 610b337fa3
56 changed files with 577 additions and 144 deletions

60
.drone.star Normal file
View File

@@ -0,0 +1,60 @@
# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt)
#
# Copyright Rene Rivera 2020.
# For Drone CI we use the Starlark scripting language to reduce duplication.
# As the yaml syntax for Drone CI is rather limited.
#
#
globalenv={'B2_CI_VERSION': '1', 'B2_VARIANT': 'release'}
linuxglobalimage="cppalliance/droneubuntu1804:1"
windowsglobalimage="cppalliance/dronevs2019"
def main(ctx):
return [
linux_cxx("gcc 11 arm64", "g++-11", packages="g++-11", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:multiarch", environment={'B2_TOOLSET': 'gcc-11', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '17ba079169m'}, arch="arm64", globalenv=globalenv),
# A set of jobs based on the earlier .travis.yml configuration:
linux_cxx("GCC 10, Debug + Coverage", "g++-10", packages="g++-10 libssl-dev libffi-dev binutils-gold gdb mlocate", image="cppalliance/droneubuntu2004:1", buildtype="boost_v1", buildscript="drone", environment={"GCOV": "gcov-10", "LCOV_VERSION": "1.15", "VARIANT": "process_coverage", "TOOLSET": "gcc", "COMPILER": "g++-10", "CXXSTD": "14", "DRONE_BEFORE_INSTALL" : "process_coverage", "CODECOV_TOKEN": {"from_secret": "codecov_token"}}, globalenv=globalenv, privileged=True),
linux_cxx("Default clang++ with libc++", "clang++-libc++", packages="libc++-dev mlocate", image="cppalliance/droneubuntu1604:1", buildtype="boost_v1", buildscript="drone", environment={ "B2_TOOLSET": "clang-7", "B2_CXXSTD": "17,2a", "VARIANT": "debug", "TOOLSET": "clang", "COMPILER": "clang++-libc++", "CXXSTD": "11", "CXX_FLAGS": "<cxxflags>-stdlib=libc++ <linkflags>-stdlib=libc++", "TRAVISCLANG" : "yes" }, globalenv=globalenv),
linux_cxx("GCC Valgrind", "g++", packages="g++-7 libssl-dev valgrind mlocate", image="cppalliance/droneubuntu2004:1", buildtype="boost_v1", buildscript="drone", environment={ "VARIANT": "process_valgrind", "TOOLSET": "gcc", "COMPILER": "g++", "CXXSTD": "11" }, globalenv=globalenv),
linux_cxx("Default g++", "g++", packages="mlocate", image="cppalliance/droneubuntu1604:1", buildtype="boost_v1", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "gcc", "COMPILER": "g++", "CXXSTD": "11" }, globalenv=globalenv),
linux_cxx("GCC 8, C++17, libstdc++, release", "g++-8", packages="g++-8 mlocate", image="cppalliance/droneubuntu1604:1", buildtype="boost_v1", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "gcc", "COMPILER": "g++-8", "CXXSTD" : "17" }, globalenv=globalenv),
linux_cxx("Clang 3.8, UBasan", "clang++-3.8", packages="clang-3.8 libssl-dev mlocate", llvm_os="precise", llvm_ver="3.8", image="cppalliance/droneubuntu1604:1", buildtype="boost_v1", buildscript="drone", environment={"VARIANT": "process_ubasan", "TOOLSET": "clang", "COMPILER": "clang++-3.8", "CXXSTD": "11", "UBSAN_OPTIONS": 'print_stacktrace=1', "DRONE_BEFORE_INSTALL": "UBasan" }, globalenv=globalenv),
linux_cxx("docs", "", packages="docbook docbook-xml docbook-xsl xsltproc libsaxonhe-java default-jre-headless flex libfl-dev bison unzip rsync mlocate", image="cppalliance/droneubuntu1804:1", buildtype="docs", buildscript="drone", environment={"COMMENT": "docs"}, globalenv=globalenv),
# Next, a standard list of tests from boost-ci:
linux_cxx("asan", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'asan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '11,14', 'B2_ASAN': '1', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'DRONE_EXTRA_PRIVILEGED': 'True', 'DRONE_JOB_UUID': '356a192b79'}, globalenv=globalenv, privileged=True),
linux_cxx("tsan", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'tsan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '11,14', 'B2_TSAN': '1', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'DRONE_JOB_UUID': 'da4b9237ba'}, globalenv=globalenv),
linux_cxx("ubsan", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'ubsan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '11,14', 'B2_UBSAN': '1', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'B2_LINKFLAGS': '-fuse-ld=gold', 'DRONE_JOB_UUID': '77de68daec'}, globalenv=globalenv),
# a boost-ci based version of codecov. However, codecov has already been run, above.
# linux_cxx("codecov", "g++-8", packages="g++-8", buildtype="codecov", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'codecov.io', 'B2_CXXSTD': '11', 'B2_TOOLSET': 'gcc-8', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'DRONE_JOB_UUID': 'b6589fc6ab', "CODECOV_TOKEN": {"from_secret": "codecov_token"}}, globalenv=globalenv),
# gcc 4.8 is failing:
# # linux_cxx("gcc 4.8", "g++-4.8", packages="g++-4.8", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1604:1", environment={'B2_TOOLSET': 'gcc-4.8', 'B2_CXXSTD': '11', 'DRONE_JOB_UUID': 'ac3478d69a'}, globalenv=globalenv),
linux_cxx("gcc 5", "g++-5", packages="g++-5", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-5', 'B2_CXXSTD': '11', 'DRONE_JOB_UUID': '902ba3cda1'}, globalenv=globalenv),
linux_cxx("gcc 6", "g++-6", packages="g++-6", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-6', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': 'fe5dbbcea5'}, globalenv=globalenv),
# # linux_cxx("gcc 7", "g++-7", packages="g++-7", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-7', 'B2_CXXSTD': '14,17', 'DRONE_JOB_UUID': '0ade7c2cf9'}, globalenv=globalenv),
# # linux_cxx("gcc 8", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': 'b1d5781111'}, globalenv=globalenv),
# # linux_cxx("gcc 9", "g++-9", packages="g++-9", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-9', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '17ba079149'}, globalenv=globalenv),
# # linux_cxx("gcc 10", "g++-10", packages="g++-10", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'B2_TOOLSET': 'gcc-10', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '17ba079159'}, globalenv=globalenv),
linux_cxx("gcc 11", "g++-11", packages="g++-11", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'B2_TOOLSET': 'gcc-11', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '17ba079169'}, globalenv=globalenv),
linux_cxx("clang 3.8", "clang++-3.8", packages="clang-3.8", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1604:1", environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-3.8', 'B2_CXXSTD': '11', 'DRONE_JOB_UUID': '7b52009b64'}, globalenv=globalenv),
# # linux_cxx("clang 4.0", "clang++-4.0", packages="clang-4.0 libstdc++-6-dev", llvm_os="xenial", llvm_ver="4.0", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1604:1", environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-4.0', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': 'bd307a3ec3'}, globalenv=globalenv),
# # linux_cxx("clang 5.0", "clang++-5.0", packages="clang-5.0 libstdc++-7-dev", llvm_os="bionic", llvm_ver="5.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-5.0', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': 'fa35e19212'}, globalenv=globalenv),
# # linux_cxx("clang 6.0", "clang++-6.0", packages="clang-6.0 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="bionic", llvm_ver="6.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-6.0', 'B2_CXXSTD': '14,17', 'DRONE_JOB_UUID': 'f1abd67035'}, globalenv=globalenv),
# # linux_cxx("clang 7", "clang++-7", packages="clang-7 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="bionic", llvm_ver="7", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-7', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '1574bddb75'}, globalenv=globalenv),
# # linux_cxx("clang 8", "clang++-8", packages="clang-8 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="bionic", llvm_ver="8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-8', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '0716d9708d'}, globalenv=globalenv),
# # linux_cxx("clang 9", "clang++-9", packages="clang-9 libc6-dbg libc++-dev libstdc++-9-dev", llvm_os="bionic", llvm_ver="9", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-9', 'B2_CXXSTD': '11,14,17,2a', 'DRONE_JOB_UUID': '9e6a55b6b4'}, globalenv=globalenv),
# # linux_cxx("clang 10", "clang++-10", packages="clang-10 libc6-dbg libc++-dev libstdc++-9-dev", llvm_os="focal", llvm_ver="10", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-10', 'B2_CXXSTD': '11,14,17,2a', 'DRONE_JOB_UUID': '9e6a55b6c4'}, globalenv=globalenv),
# # linux_cxx("clang 11", "clang++-11", packages="clang-11 libc6-dbg libc++-dev libstdc++-9-dev", llvm_os="focal", llvm_ver="11", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-11', 'B2_CXXSTD': '11,14,17,2a', 'DRONE_JOB_UUID': '9e6a55b6b4'}, globalenv=globalenv),
linux_cxx("clang 12", "clang++-12", packages="clang-12 libc6-dbg libc++-dev libstdc++-9-dev", llvm_os="focal", llvm_ver="12", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-12', 'B2_CXXSTD': '11,14,17,20', 'DRONE_JOB_UUID': '9e6a55b6b5'}, globalenv=globalenv),
# # linux_cxx("clang 6.0 libc++", "clang++-6.0", packages="clang-6.0 libc6-dbg libc++-dev libstdc++-8-dev libc++abi-dev", llvm_os="bionic", llvm_ver="6.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-6.0', 'B2_CXXSTD': '11,14', 'B2_STDLIB': 'libc++', 'DRONE_JOB_UUID': 'b3f0c7f6bb'}, globalenv=globalenv),
osx_cxx("clang", "g++", packages="", buildtype="boost", buildscript="drone", environment={'B2_TOOLSET': 'clang', 'B2_CXXSTD': '11,17', 'DRONE_JOB_UUID': '91032ad7bb'}, globalenv=globalenv),
linux_cxx("coverity", "g++", packages="", buildtype="coverity", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'Coverity Scan', 'B2_TOOLSET': 'clang', 'DRONE_JOB_UUID': '472b07b9fc'}, globalenv=globalenv),
windows_cxx("msvc-14.1", "", image="cppalliance/dronevs2017", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.1", "CXXSTD": "17", "DEFINE" : "BOOST_BEAST_USE_STD_STRING_VIEW", "ADDRESS_MODEL": "64"}),
# # windows_cxx("msvc-14.2", "", image="cppalliance/dronevs2019", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.2", "CXXSTD": "17", "DEFINE" : "BOOST_BEAST_USE_STD_STRING_VIEW", "ADDRESS_MODEL": "64"}),
windows_cxx("msvc-14.3", "", image="cppalliance/dronevs2022:1", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.3", "CXXSTD": "20", "DEFINE" : "BOOST_BEAST_USE_STD_STRING_VIEW", "ADDRESS_MODEL": "64"}),
]
# from https://github.com/boostorg/boost-ci
load("@boost_ci//ci/drone/:functions.star", "linux_cxx","windows_cxx","osx_cxx","freebsd_cxx")

36
.drone/drone.bat Executable file
View File

@@ -0,0 +1,36 @@
@ECHO ON
setlocal enabledelayedexpansion
if "%DRONE_JOB_BUILDTYPE%" == "boost" (
echo '==================================> INSTALL'
git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1
cp -prf boost-ci-cloned/ci .
rm -rf boost-ci-cloned
REM source ci/travis/install.sh
REM The contents of install.sh below:
for /F %%i in ("%DRONE_REPO%") do @set SELF=%%~nxi
SET BOOST_CI_TARGET_BRANCH=%DRONE_COMMIT_BRANCH%
SET BOOST_CI_SRC_FOLDER=%cd%
call ci\common_install.bat
echo '==================================> COMPILE'
REM set B2_TARGETS=libs/!SELF!/test libs/!SELF!/example
set B2_TARGETS=libs/!SELF!/test
cd !BOOST_ROOT!
call bootstrap.bat
b2 headers
b2 --debug-configuration variant=%VARIANT% cxxstd=%CXXSTD% define=%DEFINE% address-model=%ADDRESS_MODEL% toolset=%TOOLSET% --verbose-test libs/!SELF!/test -j3
b2 --debug-configuration variant=%VARIANT% cxxstd=%CXXSTD% define=%DEFINE% address-model=%ADDRESS_MODEL% toolset=%TOOLSET% --verbose-test libs/!SELF!/example -j3
) else if "%DRONE_JOB_BUILDTYPE%" == "standalone-windows" (
REM not used
)

199
.drone/drone.sh Executable file
View File

@@ -0,0 +1,199 @@
#!/bin/bash
# Copyright 2020 Rene Rivera, Sam Darwin
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt)
set -xe
export TRAVIS_BUILD_DIR=$(pwd)
export DRONE_BUILD_DIR=$(pwd)
export TRAVIS_BRANCH=$DRONE_BRANCH
export TRAVIS_EVENT_TYPE=$DRONE_BUILD_EVENT
export VCS_COMMIT_ID=$DRONE_COMMIT
export GIT_COMMIT=$DRONE_COMMIT
export REPO_NAME=$DRONE_REPO
export USER=$(whoami)
export CC=${CC:-gcc}
export PATH=~/.local/bin:/usr/local/bin:$PATH
common_install () {
git clone https://github.com/boostorg/boost-ci.git boost-ci-cloned --depth 1
cp -prf boost-ci-cloned/ci .
rm -rf boost-ci-cloned
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
unset -f cd
fi
export SELF=`basename $REPO_NAME`
export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH"
export BOOST_CI_SRC_FOLDER=$(pwd)
. ./ci/common_install.sh
}
if [ "$DRONE_JOB_BUILDTYPE" == "boost" ]; then
echo '==================================> INSTALL'
common_install
echo '==================================> SCRIPT'
$BOOST_ROOT/libs/$SELF/ci/travis/build.sh
elif [ "$DRONE_JOB_BUILDTYPE" == "docs" ]; then
echo '==================================> INSTALL'
export SELF=`basename $REPO_NAME`
pwd
cd ..
mkdir -p $HOME/cache && cd $HOME/cache
if [ ! -d doxygen ]; then git clone -b 'Release_1_8_15' --depth 1 https://github.com/doxygen/doxygen.git && echo "not-cached" ; else echo "cached" ; fi
cd doxygen
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
cd build
sudo make install
cd ../..
if [ ! -f saxonhe.zip ]; then wget -O saxonhe.zip https://sourceforge.net/projects/saxon/files/Saxon-HE/9.9/SaxonHE9-9-1-4J.zip/download && echo "not-cached" ; else echo "cached" ; fi
unzip -o saxonhe.zip
sudo rm /usr/share/java/Saxon-HE.jar
sudo cp saxon9he.jar /usr/share/java/Saxon-HE.jar
cd ..
BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root --depth 1
cd boost-root
export BOOST_ROOT=$(pwd)
git submodule update --init libs/context
git submodule update --init tools/boostbook
git submodule update --init tools/boostdep
git submodule update --init tools/docca
git submodule update --init tools/quickbook
rsync -av $TRAVIS_BUILD_DIR/ libs/$SELF
python tools/boostdep/depinst/depinst.py ../tools/quickbook
./bootstrap.sh
./b2 headers
echo '==================================> SCRIPT'
echo "using doxygen ; using boostbook ; using saxonhe ;" > tools/build/src/user-config.jam
./b2 -j3 libs/$SELF/doc//boostrelease
elif [ "$DRONE_JOB_BUILDTYPE" == "codecov" ]; then
echo '==================================> INSTALL'
common_install
echo '==================================> SCRIPT'
cd $BOOST_ROOT/libs/$SELF
ci/travis/codecov.sh
elif [ "$DRONE_JOB_BUILDTYPE" == "valgrind" ]; then
echo '==================================> INSTALL'
common_install
echo '==================================> SCRIPT'
cd $BOOST_ROOT/libs/$SELF
ci/travis/valgrind.sh
elif [ "$DRONE_JOB_BUILDTYPE" == "standalone" ]; then
echo '==================================> INSTALL'
# Installing cmake with apt-get, so not required here:
# pip install --user cmake
echo '==================================> SCRIPT'
export CXXFLAGS="-Wall -Wextra -Werror -std=c++17"
mkdir __build_17
cd __build_17
cmake -DBOOST_JSON_STANDALONE=1 ..
cmake --build .
ctest -V .
export CXXFLAGS="-Wall -Wextra -Werror -std=c++2a"
mkdir ../__build_2a
cd ../__build_2a
cmake -DBOOST_JSON_STANDALONE=1 ..
cmake --build .
ctest -V .
elif [ "$DRONE_JOB_BUILDTYPE" == "coverity" ]; then
echo '==================================> INSTALL'
common_install
echo '==================================> SCRIPT'
if [ $VARIANT = "process_valgrind" ];
then export USE_VALGRIND="testing.launcher=valgrind valgrind=on";
fi ;
if [ -n "${COVERITY_SCAN_NOTIFICATION_EMAIL}" -a \( "$TRAVIS_BRANCH" = "develop" -o "$TRAVIS_BRANCH" = "master" \) -a \( "$DRONE_BUILD_EVENT" = "push" -o "$DRONE_BUILD_EVENT" = "cron" \) ] ; then
cd $BOOST_ROOT/libs/$SELF
ci/travis/coverity.sh
fi
elif [ "$DRONE_JOB_BUILDTYPE" == "cmake-superproject" ]; then
echo '==================================> INSTALL'
common_install
echo '==================================> COMPILE'
export CXXFLAGS="-Wall -Wextra -Werror"
mkdir __build_static
cd __build_static
cmake -DBOOST_ENABLE_CMAKE=1 -DBUILD_TESTING=ON -DBoost_VERBOSE=1 \
-DBOOST_INCLUDE_LIBRARIES=$SELF ..
cmake --build .
ctest --output-on-failure -R boost_$SELF
cd ..
mkdir __build_shared
cd __build_shared
cmake -DBOOST_ENABLE_CMAKE=1 -DBUILD_TESTING=ON -DBoost_VERBOSE=1 \
-DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON ..
cmake --build .
ctest --output-on-failure -R boost_$SELF
elif [ "$DRONE_JOB_BUILDTYPE" == "cmake1" ]; then
echo '==================================> INSTALL'
pip install --user cmake
echo '==================================> SCRIPT'
export SELF=`basename $REPO_NAME`
BOOST_BRANCH=develop && [ "$DRONE_BRANCH" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
mkdir -p libs/$SELF
cp -r $DRONE_BUILD_DIR/* libs/$SELF
# git submodule update --init tools/boostdep
git submodule update --init --recursive
cd libs/$SELF
../../../b2 -sBOOST_BUILD_PATH=.
../../../b2 $MULTITHREAD with-valgrind address-model=64 architecture=x86 $USE_VALGRIND toolset=$TOOLSET cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=. $REPORT_CI
../../../b2 $MULTITHREAD without-valgrind address-model=64 architecture=x86 toolset=$TOOLSET cxxflags="--coverage -DBOOST_TRAVISCI_BUILD -std=$CXX_STANDARD" linkflags="--coverage" -sBOOST_BUILD_PATH=. $REPORT_CI
fi

View File

@@ -6,12 +6,13 @@
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_process VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
find_package(Boost REQUIRED iostreams program_options filesystem system thread)
add_library(boost_process INTERFACE)
add_library(Boost::process ALIAS boost_process)
target_include_directories(boost_process INTERFACE include)
include_directories(include)
target_link_libraries(boost_process
INTERFACE
Boost::algorithm

View File

@@ -82,10 +82,10 @@ int result = bp::system("/usr/bin/g++", "main.cpp");
```
With that syntax we still have "g++" hard-coded, so let's assume we get the string
from an external source as `boost::filesystem::path`, we can do this too.
from an external source as `boost::process::filesystem::path`, we can do this too.
```
boost::filesystem::path p = "/usr/bin/g++"; //or get it from somewhere else.
boost::process::filesystem::path p = "/usr/bin/g++"; //or get it from somewhere else.
int result = bp::system(p, "main.cpp");
```
@@ -93,7 +93,7 @@ Now we might want to find the `g++` executable in the `PATH`-variable, as the `c
`Boost.process` provides a function to this end: bp::search_path.
```
boost::filesystem::path p = bp::search_path("g++"); //or get it from somewhere else.
boost::process::filesystem::path p = bp::search_path("g++"); //or get it from somewhere else.
int result = bp::system(p, "main.cpp");
```

View File

@@ -22,7 +22,7 @@ int main()
bp::std_in < bp::null //null in
);
boost::filesystem::path p = "input.txt";
boost::process::filesystem::path p = "input.txt";
bp::system(
"test.exe",

View File

@@ -8,7 +8,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
namespace bp = boost::process;
@@ -19,9 +19,9 @@ int main()
bp::start_dir="../foo"
);
boost::filesystem::path exe = "test.exe";
boost::process::filesystem::path exe = "test.exe";
bp::system(
boost::filesystem::absolute(exe),
boost::process::filesystem::absolute(exe),
bp::start_dir="../foo"
);
}

View File

@@ -8,6 +8,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/process.hpp>
#include <boost/process/extend.hpp>
#include <boost/process/windows.hpp>
#include <iostream>
@@ -22,9 +23,9 @@ int main()
bp::system("test.exe",
bp::on_setup([](auto &e)
bp::extend::on_setup([](auto &e)
{ e.startup_info.dwFlags = STARTF_RUNFULLSCREEN; }),
bp::on_error([](auto&, const std::error_code & ec)
bp::extend::on_error([](auto&, const std::error_code & ec)
{ std::cerr << ec.message() << std::endl; })
);
}

View File

@@ -168,7 +168,7 @@ struct exe_builder
string_type exe;
std::vector<string_type> args;
void operator()(const boost::filesystem::path & data)
void operator()(const boost::process::filesystem::path & data)
{
not_cmd = true;
if (exe.empty())

View File

@@ -11,7 +11,7 @@
#define BOOST_PROCESS_POSIX_PIPE_HPP
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/process/detail/posix/compare_handles.hpp>
#include <system_error>
#include <array>
@@ -95,7 +95,7 @@ public:
int_type read(char_type * data, int_type count)
{
int_type read_len;
while ((read_len = ::read(_source, data, count * sizeof(char_type))) == -1)
while ((read_len = static_cast<int_type>(::read(_source, data, count * sizeof(char_type)))) == -1)
{
//Try again if interrupted
auto err = errno;

View File

@@ -26,6 +26,8 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/core/ignore_unused.hpp>
namespace boost { namespace process { namespace detail { namespace posix {
template<typename Executor>
@@ -155,8 +157,8 @@ class executor
const auto len = std::strlen(msg);
int data[2] = {ec.value(), static_cast<int>(len + 1)};
::write(_pipe_sink, &data[0], sizeof(int) * 2);
::write(_pipe_sink, msg, len);
boost::ignore_unused(::write(_pipe_sink, &data[0], sizeof(int) * 2));
boost::ignore_unused(::write(_pipe_sink, msg, len));
}
void internal_error_handle(const std::error_code &ec, const char* msg, boost::mpl::true_ , boost::mpl::false_, boost::mpl::false_)

View File

@@ -8,7 +8,7 @@
#include <fcntl.h>
#include <string>
#include <boost/filesystem/path.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/core/exchange.hpp>
namespace boost { namespace process { namespace detail { namespace posix {
@@ -24,7 +24,7 @@ struct file_descriptor
file_descriptor() = default;
explicit file_descriptor(const boost::filesystem::path& p, mode_t mode = read_write)
explicit file_descriptor(const boost::process::filesystem::path& p, mode_t mode = read_write)
: file_descriptor(p.native(), mode)
{
}

View File

@@ -11,7 +11,7 @@
#define BOOST_PROCESS_POSIX_SEARCH_PATH_HPP
#include <boost/process/detail/config.hpp>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/tokenizer.hpp>
#include <string>
#include <stdexcept>
@@ -20,15 +20,15 @@
namespace boost { namespace process { namespace detail { namespace posix {
inline boost::filesystem::path search_path(
const boost::filesystem::path &filename,
const std::vector<boost::filesystem::path> &path)
inline boost::process::filesystem::path search_path(
const boost::process::filesystem::path &filename,
const std::vector<boost::process::filesystem::path> &path)
{
for (const boost::filesystem::path & pp : path)
for (const boost::process::filesystem::path & pp : path)
{
auto p = pp / filename;
boost::system::error_code ec;
bool file = boost::filesystem::is_regular_file(p, ec);
bool file = boost::process::filesystem::is_regular_file(p, ec);
if (!ec && file && ::access(p.c_str(), X_OK) == 0)
return p;
}

View File

@@ -12,16 +12,16 @@
#include <boost/process/detail/config.hpp>
#include <boost/system/error_code.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/process/filesystem.hpp>
namespace boost { namespace process { namespace detail { namespace posix {
inline boost::filesystem::path shell_path()
inline boost::process::filesystem::path shell_path()
{
return "/bin/sh";
}
inline boost::filesystem::path shell_path(std::error_code &ec)
inline boost::process::filesystem::path shell_path(std::error_code &ec)
{
ec.clear();
return "/bin/sh";

View File

@@ -13,6 +13,7 @@
#include <boost/process/detail/posix/handler.hpp>
#include <string>
#include <unistd.h>
#include <boost/core/ignore_unused.hpp>
namespace boost { namespace process { namespace detail { namespace posix {
@@ -26,7 +27,7 @@ struct start_dir_init : handler_base_ext
template <class PosixExecutor>
void on_exec_setup(PosixExecutor&) const
{
::chdir(s_.c_str());
boost::ignore_unused(::chdir(s_.c_str()));
}
const string_type & str() const {return s_;}
private:

View File

@@ -11,7 +11,7 @@
#include <vector>
#include <type_traits>
#include <initializer_list>
#include <boost/filesystem/path.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/process/detail/traits/decl.hpp>
namespace boost { namespace process { namespace detail {
@@ -53,12 +53,12 @@ template<> struct initializer_tag<std::initializer_list<const wchar_t *>> { type
template<> struct initializer_tag<shell_>
{
typedef cmd_or_exe_tag<typename boost::filesystem::path::value_type> type;
typedef cmd_or_exe_tag<typename boost::process::filesystem::path::value_type> type;
};
template<> struct initializer_tag<boost::filesystem::path>
template<> struct initializer_tag<boost::process::filesystem::path>
{
typedef cmd_or_exe_tag<typename boost::filesystem::path::value_type> type;
typedef cmd_or_exe_tag<typename boost::process::filesystem::path::value_type> type;
};
template <typename Char>

View File

@@ -20,7 +20,7 @@ namespace boost { namespace process { namespace detail {
template<typename T> struct is_wchar_t : std::false_type {};
template<> struct is_wchar_t<boost::filesystem::path> : std::is_same<typename boost::filesystem::path::value_type, wchar_t>
template<> struct is_wchar_t<boost::process::filesystem::path> : std::is_same<typename boost::process::filesystem::path::value_type, wchar_t>
{
};

View File

@@ -232,6 +232,8 @@ basic_environment_impl<Char>::basic_environment_impl(const native_environment_im
template<typename Char>
inline auto basic_environment_impl<Char>::get(const string_type &id) -> string_type
{
if (id.size() >= _data.size()) //ok, so it's impossible id is in there.
return string_type(_data.data());
if (std::equal(id.begin(), id.end(), _data.begin()) && (_data[id.size()] == equal_sign<Char>()))
return string_type(_data.data()); //null-char is handled by the string.

View File

@@ -10,7 +10,7 @@
#include <boost/winapi/handles.hpp>
#include <boost/winapi/file_management.hpp>
#include <string>
#include <boost/filesystem/path.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/core/exchange.hpp>
namespace boost { namespace process { namespace detail { namespace windows {
@@ -40,7 +40,7 @@ struct file_descriptor
}
file_descriptor() = default;
file_descriptor(const boost::filesystem::path& p, mode_t mode = read_write)
file_descriptor(const boost::process::filesystem::path& p, mode_t mode = read_write)
: file_descriptor(p.native(), mode)
{
}

View File

@@ -11,6 +11,7 @@
#include <boost/process/detail/windows/handle_workaround.hpp>
#include <boost/process/detail/windows/handler.hpp>
#include <boost/winapi/get_current_process_id.hpp>
#include <boost/winapi/handles.hpp>
namespace boost { namespace process { namespace detail {

View File

@@ -11,8 +11,7 @@
#define BOOST_PROCESS_WINDOWS_SEARCH_PATH_HPP
#include <boost/process/detail/config.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/system/error_code.hpp>
#include <string>
#include <stdexcept>
@@ -24,9 +23,9 @@
namespace boost { namespace process { namespace detail { namespace windows {
inline boost::filesystem::path search_path(
const boost::filesystem::path &filename,
const std::vector<boost::filesystem::path> &path)
inline boost::process::filesystem::path search_path(
const boost::process::filesystem::path &filename,
const std::vector<boost::process::filesystem::path> &path)
{
const ::boost::process::wnative_environment ne{};
typedef typename ::boost::process::wnative_environment::const_entry_type value_type;
@@ -55,15 +54,15 @@ inline boost::filesystem::path search_path(
for (auto & ext : extensions)
boost::to_lower(ext);
for (const boost::filesystem::path & pp_ : path)
for (const boost::process::filesystem::path & pp_ : path)
{
auto p = pp_ / filename;
for (boost::filesystem::path ext : extensions)
for (boost::process::filesystem::path ext : extensions)
{
boost::filesystem::path pp_ext = p;
boost::process::filesystem::path pp_ext = p;
pp_ext += ext;
boost::system::error_code ec;
bool file = boost::filesystem::is_regular_file(pp_ext, ec);
bool file = boost::process::filesystem::is_regular_file(pp_ext, ec);
if (!ec && file &&
::boost::winapi::sh_get_file_info(pp_ext.native().c_str(), 0, 0, 0, ::boost::winapi::SHGFI_EXETYPE_))
{

View File

@@ -12,29 +12,29 @@
#include <boost/process/detail/config.hpp>
#include <system_error>
#include <boost/filesystem/path.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/winapi/basic_types.hpp>
#include <boost/winapi/get_system_directory.hpp>
namespace boost { namespace process { namespace detail { namespace windows {
inline boost::filesystem::path shell_path()
inline boost::process::filesystem::path shell_path()
{
::boost::winapi::WCHAR_ sysdir[260];
unsigned int size = ::boost::winapi::get_system_directory(sysdir, sizeof(sysdir));
if (!size)
throw_last_error("GetSystemDirectory() failed");
boost::filesystem::path p = sysdir;
boost::process::filesystem::path p = sysdir;
return p / "cmd.exe";
}
inline boost::filesystem::path shell_path(std::error_code &ec) noexcept
inline boost::process::filesystem::path shell_path(std::error_code &ec) noexcept
{
::boost::winapi::WCHAR_ sysdir[260];
unsigned int size = ::boost::winapi::get_system_directory(sysdir, sizeof(sysdir));
boost::filesystem::path p;
boost::process::filesystem::path p;
if (!size)
ec = std::error_code(
::boost::winapi::GetLastError(),

View File

@@ -11,7 +11,7 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/process/filesystem.hpp>
#if defined(BOOST_POSIX_API)
#include <boost/process/detail/posix/environment.hpp>
@@ -263,7 +263,9 @@ public:
auto st1 = key + ::boost::process::detail::equal_sign<Char>();
while (*p != nullptr)
{
if (std::equal(st1.begin(), st1.end(), *p))
const int len = std::char_traits<Char>::length(*p);
if ((std::distance(st1.begin(), st1.end()) < len)
&& std::equal(st1.begin(), st1.end(), *p))
break;
p++;
}
@@ -275,7 +277,9 @@ public:
auto st1 = key + ::boost::process::detail::equal_sign<Char>();
while (*p != nullptr)
{
if (std::equal(st1.begin(), st1.end(), *p))
const int len = std::char_traits<Char>::length(*p);
if ((std::distance(st1.begin(), st1.end()) < len)
&& std::equal(st1.begin(), st1.end(), *p))
break;
p++;
}
@@ -288,7 +292,9 @@ public:
auto st1 = st + ::boost::process::detail::equal_sign<Char>();
while (*p != nullptr)
{
if (std::equal(st1.begin(), st1.end(), *p))
const int len = std::char_traits<Char>::length(*p);
if ((std::distance(st1.begin(), st1.end()) < len)
&& std::equal(st1.begin(), st1.end(), *p))
return 1u;
p++;
}
@@ -672,7 +678,7 @@ inline native_environment environment() { return ::boost::process:: native_env
///Get the enviroment of the current process.
inline wnative_environment wenvironment() { return ::boost::process::wnative_environment(); }
///Get the path environment variable of the current process runs.
inline std::vector<boost::filesystem::path> path()
inline std::vector<boost::process::filesystem::path> path()
{
#if defined(BOOST_WINDOWS_API)
const ::boost::process::wnative_environment ne{};
@@ -693,7 +699,7 @@ inline std::vector<boost::filesystem::path> path()
auto vec = itr->to_vector();
std::vector<boost::filesystem::path> val;
std::vector<boost::process::filesystem::path> val;
val.resize(vec.size());
std::copy(vec.begin(), vec.end(), val.begin());

View File

@@ -36,15 +36,15 @@ namespace detail {
struct exe_
{
template<typename = void>
inline exe_setter_<typename boost::filesystem::path::value_type> operator()(const boost::filesystem::path & pth) const
inline exe_setter_<typename boost::process::filesystem::path::value_type> operator()(const boost::process::filesystem::path & pth) const
{
return exe_setter_<typename boost::filesystem::path::value_type>(pth.native());
return exe_setter_<typename boost::process::filesystem::path::value_type>(pth.native());
}
template<typename = void>
inline exe_setter_<typename boost::filesystem::path::value_type> operator=(const boost::filesystem::path & pth) const
inline exe_setter_<typename boost::process::filesystem::path::value_type> operator=(const boost::process::filesystem::path & pth) const
{
return exe_setter_<typename boost::filesystem::path::value_type>(pth.native());
return exe_setter_<typename boost::process::filesystem::path::value_type>(pth.native());
}
@@ -79,7 +79,7 @@ The overload form applies when to the first, when several strings are passed to
function.
The following expressions are valid, with `value` being either a C-String or
a `std::basic_string` with `char` or `wchar_t` or a `boost::filesystem::path`.
a `std::basic_string` with `char` or `wchar_t` or a `boost::process::filesystem::path`.
\code{.cpp}
exe="value";

View File

@@ -0,0 +1,28 @@
// Copyright (c) 2021 Klemens D. Morgenstern
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROCESS_FILESYSTEM_HPP
#define BOOST_PROCESS_FILESYSTEM_HPP
#ifdef BOOST_PROCESS_USE_STD_FS
#include <filesystem>
#else
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#endif
namespace boost
{
namespace process
{
#ifdef BOOST_PROCESS_USE_STD_FS
namespace filesystem = std::filesystem;
#else
namespace filesystem = boost::filesystem;
#endif
}
}
#endif //BOOST_PROCESS_FILESYSTEM_HPP

View File

@@ -60,9 +60,9 @@ namespace boost {
The library allows full redirection of streams to files as shown below.
\code{.cpp}
boost::filesystem::path log = "my_log_file.txt";
boost::filesystem::path input = "input.txt";
boost::filesystem::path output = "output.txt";
boost::process::filesystem::path log = "my_log_file.txt";
boost::process::filesystem::path input = "input.txt";
boost::process::filesystem::path output = "output.txt";
system("my_prog", std_out>output, std_in<input, std_err>log);
\endcode
@@ -152,13 +152,13 @@ struct std_in_
api::null_in operator=(const null_t &) const {return api::null_in();}
api::null_in operator<(const null_t &) const {return api::null_in();}
api::file_in operator=(const boost::filesystem::path &p) const {return p;}
api::file_in operator=(const boost::process::filesystem::path &p) const {return p;}
api::file_in operator=(const std::string & p) const {return p;}
api::file_in operator=(const std::wstring &p) const {return p;}
api::file_in operator=(const char * p) const {return p;}
api::file_in operator=(const wchar_t * p) const {return p;}
api::file_in operator<(const boost::filesystem::path &p) const {return p;}
api::file_in operator<(const boost::process::filesystem::path &p) const {return p;}
api::file_in operator<(const std::string &p) const {return p;}
api::file_in operator<(const std::wstring &p) const {return p;}
api::file_in operator<(const char*p) const {return p;}
@@ -209,13 +209,13 @@ struct std_out_
api::null_out<p1,p2> operator=(const null_t &) const {return api::null_out<p1,p2>();}
api::null_out<p1,p2> operator>(const null_t &) const {return api::null_out<p1,p2>();}
api::file_out<p1,p2> operator=(const boost::filesystem::path &p) const {return api::file_out<p1,p2>(p);}
api::file_out<p1,p2> operator=(const boost::process::filesystem::path &p) const {return api::file_out<p1,p2>(p);}
api::file_out<p1,p2> operator=(const std::string &p) const {return api::file_out<p1,p2>(p);}
api::file_out<p1,p2> operator=(const std::wstring &p) const {return api::file_out<p1,p2>(p);}
api::file_out<p1,p2> operator=(const char * p) const {return api::file_out<p1,p2>(p);}
api::file_out<p1,p2> operator=(const wchar_t * p) const {return api::file_out<p1,p2>(p);}
api::file_out<p1,p2> operator>(const boost::filesystem::path &p) const {return api::file_out<p1,p2>(p);}
api::file_out<p1,p2> operator>(const boost::process::filesystem::path &p) const {return api::file_out<p1,p2>(p);}
api::file_out<p1,p2> operator>(const std::string &p) const {return api::file_out<p1,p2>(p);}
api::file_out<p1,p2> operator>(const std::wstring &p) const {return api::file_out<p1,p2>(p);}
api::file_out<p1,p2> operator>(const char * p) const {return api::file_out<p1,p2>(p);}
@@ -282,7 +282,7 @@ This property allows to set the input stream for the child process.
The file I/O simple redirects the stream to a file, for which the possible types are
- `boost::filesystem::path`
- `boost::process::filesystem::path`
- `std::basic_string<char_type>`
- `const char_type*`
- `FILE*`
@@ -424,7 +424,7 @@ This property allows to set the output stream for the child process.
The file I/O simple redirects the stream to a file, for which the possible types are
- `boost::filesystem::path`
- `boost::process::filesystem::path`
- `std::basic_string<char_type>`
- `const char_type*`
- `FILE*`

View File

@@ -44,8 +44,8 @@ namespace boost { namespace process {
* \returns the absolute path to the executable filename or an
* empty string if filename isn't found
*/
inline boost::filesystem::path search_path(const boost::filesystem::path &filename,
const std::vector<boost::filesystem::path> path = ::boost::this_process::path())
inline boost::process::filesystem::path search_path(const boost::process::filesystem::path &filename,
const std::vector<boost::process::filesystem::path> path = ::boost::this_process::path())
{
return ::boost::process::detail::api::search_path(filename, path);
}

View File

@@ -44,18 +44,18 @@ struct shell_
{
constexpr shell_() {}
boost::filesystem::path operator()() const
boost::process::filesystem::path operator()() const
{
return boost::process::detail::api::shell_path();
}
boost::filesystem::path operator()(std::error_code & ec) const noexcept
boost::process::filesystem::path operator()(std::error_code & ec) const noexcept
{
return boost::process::detail::api::shell_path(ec);
}
};
template<>
struct is_wchar_t<shell_> : is_wchar_t<boost::filesystem::path>
struct is_wchar_t<shell_> : is_wchar_t<boost::process::filesystem::path>
{
};

View File

@@ -23,7 +23,7 @@
#include <boost/process/detail/config.hpp>
#include <string>
#include <boost/filesystem/path.hpp>
#include <boost/process/filesystem.hpp>
/** \file boost/process/start_dir.hpp
*
@@ -53,8 +53,8 @@ struct start_dir_
api::start_dir_init<Char> operator()(std::basic_string<Char> && s) const {return {std::move(s)}; }
template<typename Char>
api::start_dir_init<Char> operator()(const Char* s) const {return {s}; }
api::start_dir_init<typename boost::filesystem::path::value_type>
operator()(const boost::filesystem::path & st) const {return {st.native()}; }
api::start_dir_init<typename boost::process::filesystem::path::value_type>
operator()(const boost::process::filesystem::path & st) const {return {st.native()}; }
template<typename Char>
api::start_dir_init<Char> operator= (const std::basic_string<Char> & st) const {return {st}; }
@@ -62,8 +62,8 @@ struct start_dir_
api::start_dir_init<Char> operator= (std::basic_string<Char> && s) const {return {std::move(s)}; }
template<typename Char>
api::start_dir_init<Char> operator= (const Char* s) const {return {s}; }
api::start_dir_init<typename boost::filesystem::path::value_type>
operator= (const boost::filesystem::path & st) const {return {st.native()}; }
api::start_dir_init<typename boost::process::filesystem::path::value_type>
operator= (const boost::process::filesystem::path & st) const {return {st.native()}; }
};
@@ -100,7 +100,7 @@ start_dir=path
start_dir(path)
\endcode
It can be used with `std::string`, `std::wstring` and `boost::filesystem::path`.
It can be used with `std::string`, `std::wstring` and `boost::process::filesystem::path`.
*/

74
test/CMakeLists.txt Normal file
View File

@@ -0,0 +1,74 @@
enable_testing()
add_executable(sparring_partner sparring_partner.cpp )
target_link_libraries(sparring_partner Boost::program_options Boost::filesystem Boost::iostreams)
add_executable(exit_argc exit_argc.cpp)
add_executable(sub_launch sub_launcher.cpp)
target_link_libraries(sparring_partner Boost::program_options Boost::filesystem Boost::iostreams Boost::system)
function(process_standalone_test name )
add_executable(${name} ${name}.cpp)
target_link_libraries(${name} Boost::system Boost::filesystem)
add_test(NAME ${name} COMMAND $<TARGET_FILE:${name}> )
endfunction()
process_standalone_test(environment)
process_standalone_test(async_pipe)
process_standalone_test(pipe)
function(process_sub_launch_test name )
add_executable(${name} ${name}.cpp)
target_link_libraries(${name} Boost::system Boost::filesystem Boost::thread)
add_test(NAME ${name} COMMAND $<TARGET_FILE:${name}> $<TARGET_FILE:sub_launch> )
endfunction()
process_sub_launch_test(group)
process_sub_launch_test(group_wait)
function(process_sparring_partner_launch name )
add_executable(${name} ${name}.cpp)
target_link_libraries(${name} Boost::system Boost::filesystem Boost::thread)
add_test(NAME ${name} COMMAND $<TARGET_FILE:${name}> $<TARGET_FILE:sparring_partner> )
endfunction()
process_sparring_partner_launch(async)
process_sparring_partner_launch(async_fut)
process_sparring_partner_launch(args_handling)
process_sparring_partner_launch(args_cmd)
process_sparring_partner_launch(wargs_cmd)
process_sparring_partner_launch(bind_stderr)
process_sparring_partner_launch(bind_stdin)
process_sparring_partner_launch(bind_stdin_stdout)
process_sparring_partner_launch(bind_stdout)
process_sparring_partner_launch(bind_stdout_stderr)
process_sparring_partner_launch(pipe_fwd)
process_sparring_partner_launch(cmd_test)
process_sparring_partner_launch(close_stderr)
process_sparring_partner_launch(close_stdin)
process_sparring_partner_launch(close_stdout)
process_sparring_partner_launch(error)
process_sparring_partner_launch(exit_code)
process_sparring_partner_launch(extensions)
process_sparring_partner_launch(env)
process_sparring_partner_launch(limit_fd)
process_sparring_partner_launch(run_exe)
process_sparring_partner_launch(run_exe_path)
process_sparring_partner_launch(search_path)
process_sparring_partner_launch(shell)
process_sparring_partner_launch(shell_path)
process_sparring_partner_launch(system_test1)
process_sparring_partner_launch(system_test2)
process_sparring_partner_launch(spawn)
process_sparring_partner_launch(start_dir)
process_sparring_partner_launch(terminate)
process_sparring_partner_launch(throw_on_error)
process_sparring_partner_launch(wait)
process_sparring_partner_launch(wait_for)
process_sparring_partner_launch(on_exit)
process_sparring_partner_launch(on_exit2)
process_sparring_partner_launch(on_exit3)
process_sparring_partner_launch(posix_specific)
process_sparring_partner_launch(windows_specific)

View File

@@ -70,7 +70,7 @@ rule test-options ( name )
test-suite bare :
[ run environment.cpp system filesystem : [ test-options environment ] ]
[ run async_pipe.cpp system filesystem : [ test-options async_pipe ] ]
[ run async_pipe.cpp system filesystem : [ test-options async_pipe ] : : <target-os>darwin:<build>no ]
[ run pipe.cpp system filesystem : [ test-options pipe ] ]
[ compile no_ansi_apps.cpp ]
[ compile-fail spawn_fail.cpp ]
@@ -100,12 +100,12 @@ test-suite with-valgrind :
[ run env.cpp program_options system filesystem : [ test-options env ] : sparring_partner ]
[ run group.cpp system thread filesystem : [ test-options group ] : sub_launch ]
[ run group.cpp system thread filesystem : [ test-options group ] : sub_launch : <build>no <target-os>windows:<build>yes <define>BOOST_USE_WINDOWS_H=1 : group-windows-h ]
[ run group_wait.cpp system thread filesystem : [ test-options group_wait ] : sparring_partner ]
[ run group_wait.cpp system thread filesystem : [ test-options group_wait ] : sparring_partner : <target-os>darwin:<build>no ]
[ run limit_fd.cpp program_options system filesystem : [ test-options limit_fd ] : sparring_partner ]
[ run run_exe.cpp filesystem : : sparring_partner ]
[ run run_exe_path.cpp filesystem : [ test-options run_exe_path ] : sparring_partner ]
[ run search_path.cpp filesystem system : [ test-options search_path ] : : <target-os>windows:<source>shell32 ]
[ run shell.cpp filesystem system : [ test-options shell ] : sparring_partner ]
[ run shell.cpp filesystem system : [ test-options shell ] : sparring_partner : <target-os>darwin:<build>no ]
[ run shell_path.cpp filesystem system : [ test-options shell_path ] ]
[ run system_test1.cpp filesystem system : [ test-options system_test1 ] : sparring_partner ]
[ run system_test2.cpp filesystem system : [ test-options system_test2 ] : sparring_partner ]
@@ -125,7 +125,7 @@ test-suite with-valgrind :
test-suite without-valgrind :
[ run async_system_future.cpp filesystem system coroutine : [ test-options async_system_future ] : sparring_partner : <link>static <toolset>msvc:<cxxflags>/bigobj ]
[ run async_system_stackful.cpp filesystem system coroutine : [ test-options async_system_stackful ] : sparring_partner : <link>static <toolset>msvc:<cxxflags>/bigobj ]
[ run async_system_stackful_error.cpp filesystem system coroutine : [ test-options async_system_stackful_error ] : sparring_partner : <link>static <toolset>msvc:<cxxflags>/bigobj ]
# [ run async_system_stackful_error.cpp filesystem system coroutine : [ test-options async_system_stackful_error ] : sparring_partner : <link>static <toolset>msvc:<cxxflags>/bigobj ]
[ run async_system_stackful_except.cpp filesystem system coroutine : [ test-options async_system_stackful_except ] : sparring_partner : <link>static <toolset>msvc:<cxxflags>/bigobj ]
[ run async_system_stackless.cpp filesystem system coroutine : [ test-options async_system_stackless ] : sparring_partner : <link>static <toolset>msvc:<cxxflags>/bigobj ]
[ run vfork.cpp system filesystem : [ test-options vfork ] : sparring_partner : <build>no <target-os>linux:<build>yes ]

View File

@@ -13,7 +13,7 @@
#include <boost/test/included/unit_test.hpp>
#include <system_error>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/process/cmd.hpp>
#include <boost/process/error.hpp>
@@ -26,7 +26,7 @@ BOOST_AUTO_TEST_CASE(implicit_args_fs_path)
{
using boost::unit_test::framework::master_test_suite;
boost::filesystem::path exe = master_test_suite().argv[1];
boost::process::filesystem::path exe = master_test_suite().argv[1];
std::error_code ec;
bp::child c(
@@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(explicit_args_fs_path)
{
using boost::unit_test::framework::master_test_suite;
boost::filesystem::path exe = master_test_suite().argv[1];
boost::process::filesystem::path exe = master_test_suite().argv[1];
std::error_code ec;
bp::child c(

View File

@@ -147,8 +147,8 @@ BOOST_AUTO_TEST_CASE(async_wait_different_contexts, *boost::unit_test::timeout(1
timeout2.async_wait([&](boost::system::error_code ec){if (!ec) io_context2.stop();});
std::error_code ec;
bool exit_called_for_c1 = false;
int exit_code_c1 = 0;
std::atomic<bool> exit_called_for_c1 {false};
std::atomic<int> exit_code_c1 {0};
bp::child c1(
master_test_suite().argv[1],
"test", "--exit-code", "1",
@@ -164,8 +164,8 @@ BOOST_AUTO_TEST_CASE(async_wait_different_contexts, *boost::unit_test::timeout(1
);
BOOST_REQUIRE(!ec);
bool exit_called_for_c2 = false;
int exit_code_c2 = 0;
std::atomic<bool> exit_called_for_c2 {false};
std::atomic<int> exit_code_c2{0};
bp::child c2(
master_test_suite().argv[1],
"test", "--exit-code", "2", "--wait", "4",
@@ -174,7 +174,8 @@ BOOST_AUTO_TEST_CASE(async_wait_different_contexts, *boost::unit_test::timeout(1
bp::on_exit([&](int exit, const std::error_code& ec_in)
{
BOOST_CHECK(!exit_called_for_c2);
exit_code_c2 = exit; exit_called_for_c2=true;
exit_code_c2 = exit;
exit_called_for_c2=true;
BOOST_CHECK(!ec_in);
timeout2.cancel();
})

View File

@@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(move_pipe)
ap_inv.close();
const auto ap3 = std::move(ap_inv);
}
/*
{
//copy an a closed pipe
BOOST_TEST_CHECKPOINT("Copy assign");
@@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(move_pipe)
BOOST_TEST_CHECKPOINT("Copy construct");
bp::async_pipe ap4{ap_inv};
}
*/
}

View File

@@ -22,7 +22,8 @@
#include <boost/process/child.hpp>
#include <boost/process/async_pipe.hpp>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <string>
#include <istream>
@@ -37,7 +38,7 @@ typedef boost::asio::windows::stream_handle pipe_end;
typedef boost::asio::posix::stream_descriptor pipe_end;
#endif
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
namespace bp = boost::process;
BOOST_AUTO_TEST_SUITE( bind_stderr );
@@ -148,7 +149,7 @@ BOOST_AUTO_TEST_CASE(file_io, *boost::unit_test::timeout(2))
is >> s;
BOOST_CHECK_EQUAL(s, "hello");
}
boost::filesystem::remove(pth);
boost::process::filesystem::remove(pth);
}

View File

@@ -19,7 +19,8 @@
#include <system_error>
#include <boost/system/error_code.hpp>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/asio.hpp>
#include <string>
@@ -41,7 +42,7 @@ typedef boost::asio::posix::stream_descriptor pipe_end;
#endif
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
namespace bp = boost::process;
BOOST_AUTO_TEST_CASE(sync_io, *boost::unit_test::timeout(10))
@@ -177,7 +178,7 @@ BOOST_AUTO_TEST_CASE(file_io, *boost::unit_test::timeout(2))
bp::ipstream is;
{
boost::filesystem::ofstream fs(pth);
boost::process::filesystem::ofstream fs(pth);
fs << 321 << std::endl;
fs << 1.2345 << std::endl;
fs << "some_string" << std::endl;
@@ -205,7 +206,7 @@ BOOST_AUTO_TEST_CASE(file_io, *boost::unit_test::timeout(2))
BOOST_CHECK_EQUAL(s, "abcsome_string");
c.wait();
boost::filesystem::remove(pth);
boost::process::filesystem::remove(pth);
}
BOOST_AUTO_TEST_CASE(file_io_C, *boost::unit_test::timeout(2))
@@ -220,7 +221,7 @@ BOOST_AUTO_TEST_CASE(file_io_C, *boost::unit_test::timeout(2))
bp::ipstream is;
{
boost::filesystem::ofstream fs(pth);
boost::process::filesystem::ofstream fs(pth);
fs << 321 << std::endl;
fs << 1.2345 << std::endl;
fs << "some_string" << std::endl;
@@ -254,7 +255,7 @@ BOOST_AUTO_TEST_CASE(file_io_C, *boost::unit_test::timeout(2))
BOOST_CHECK_EQUAL(s, "abcsome_string");
c.wait();
boost::filesystem::remove(pth);
boost::process::filesystem::remove(pth);
}
BOOST_AUTO_TEST_SUITE_END();

View File

@@ -10,6 +10,7 @@
#define BOOST_TEST_MAIN
#define BOOST_TEST_IGNORE_SIGCHLD
#include <boost/test/included/unit_test.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/process/error.hpp>
#include <boost/process/io.hpp>

View File

@@ -10,6 +10,7 @@
#define BOOST_TEST_MAIN
#define BOOST_TEST_IGNORE_SIGCHLD
#include <boost/test/included/unit_test.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/system/error_code.hpp>
@@ -23,7 +24,7 @@
#include <boost/process/async_pipe.hpp>
#include <system_error>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <string>
#include <istream>
@@ -40,7 +41,7 @@ typedef boost::asio::posix::stream_descriptor pipe_end;
BOOST_AUTO_TEST_SUITE( bind_stdout );
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
namespace bp = boost::process;
BOOST_AUTO_TEST_CASE(sync_io, *boost::unit_test::timeout(5))
@@ -164,7 +165,7 @@ BOOST_AUTO_TEST_CASE(file_io, *boost::unit_test::timeout(2))
is >> s;
BOOST_CHECK_EQUAL(s, "hello");
}
boost::filesystem::remove(pth);
boost::process::filesystem::remove(pth);
}

View File

@@ -10,6 +10,7 @@
#define BOOST_TEST_MAIN
#define BOOST_TEST_IGNORE_SIGCHLD
#include <boost/test/included/unit_test.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/process/error.hpp>
#include <boost/process/io.hpp>

View File

@@ -16,7 +16,7 @@
#include <boost/process/env.hpp>
#include <boost/process/cmd.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/filesystem/operations.hpp>
#include <system_error>
@@ -27,7 +27,7 @@
#include <cstdlib>
namespace bp = boost::process;
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
BOOST_AUTO_TEST_CASE(excplicit)

View File

@@ -7,6 +7,7 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_TEST_MAIN
#define BOOST_TEST_IGNORE_SIGCHLD
#include <boost/test/included/unit_test.hpp>
@@ -31,13 +32,15 @@
namespace bp = boost::process;
BOOST_AUTO_TEST_CASE(wait_group_test, *boost::unit_test::timeout(5))
{
std::atomic<bool> done{false};
std::thread thr{
[&]
{
for (int i = 0; i < 50 && !done.load(); i++)
for (int i = 0; i < 100 && !done.load(); i++)
std::this_thread::sleep_for(std::chrono::milliseconds(100));
BOOST_REQUIRE(done.load());
}};
@@ -132,4 +135,7 @@ BOOST_AUTO_TEST_CASE(wait_group_test_timeout, *boost::unit_test::timeout(15))
done.store(true);
thr.join();
}
}

View File

@@ -16,7 +16,7 @@
#include <boost/process/async_pipe.hpp>
#include <boost/process/extend.hpp>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <system_error>
#include <string>
@@ -27,9 +27,12 @@
#if defined(BOOST_WINDOWS_API)
#include <boost/winapi/get_current_thread.hpp>
#include <boost/winapi/get_current_process.hpp>
#elif defined(__APPLE__)
#include <dirent.h>
#endif
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
namespace bp = boost::process;
namespace bt = boost::this_process;
@@ -98,7 +101,8 @@ BOOST_AUTO_TEST_CASE(leak_test, *boost::unit_test::timeout(5))
int event_fd =::eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
BOOST_CHECK(!bt::is_stream_handle(event_fd , ec)); BOOST_CHECK_MESSAGE(!ec, ec.message());
#endif
int dir_fd = ::dirfd(::opendir("."));
auto od = ::opendir(".");
int dir_fd = ::dirfd(od);
BOOST_CHECK(!bt::is_stream_handle(dir_fd , ec)); BOOST_CHECK_MESSAGE(!ec, ec.message());
#endif
@@ -115,6 +119,9 @@ BOOST_AUTO_TEST_CASE(leak_test, *boost::unit_test::timeout(5))
BOOST_CHECK(bt::is_stream_handle(socket_to_handle(udp_socket.native_handle()), ec)); BOOST_CHECK_MESSAGE(!ec, ec.message());
BOOST_CHECK(bt::is_stream_handle(std::move(ap).sink(). native_handle(), ec)); BOOST_CHECK_MESSAGE(!ec, ec.message());
BOOST_CHECK(bt::is_stream_handle(std::move(ap).source().native_handle(), ec)); BOOST_CHECK_MESSAGE(!ec, ec.message());
#if !defined( BOOST_WINDOWS_API )
::closedir(od);
#endif
}
struct on_setup_t

View File

@@ -39,8 +39,7 @@ BOOST_AUTO_TEST_CASE(named, *boost::unit_test::timeout(2))
#if defined( BOOST_WINDOWS_API )
bp::pipe pipe("\\\\.\\pipe\\pipe_name");
#elif defined( BOOST_POSIX_API )
const auto home_path = boost::this_process::environment()["HOME"].to_string();
bp::pipe pipe(home_path + "/.boost_process_test_pipe");
bp::pipe pipe("./.boost_process_test_pipe");
#endif
std::string in = "xyz";

View File

@@ -14,7 +14,7 @@
#include <boost/process.hpp>
#include <boost/process/posix.hpp>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <system_error>
@@ -23,7 +23,7 @@
#include <sys/wait.h>
#include <errno.h>
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
namespace bp = boost::process;
BOOST_AUTO_TEST_CASE(bind_fd, *boost::unit_test::timeout(2))

View File

@@ -12,7 +12,7 @@
#include <boost/test/included/unit_test.hpp>
#include <system_error>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/process/cmd.hpp>
#include <boost/process/error.hpp>
@@ -25,7 +25,7 @@ BOOST_AUTO_TEST_CASE(run_exe_success)
{
using boost::unit_test::framework::master_test_suite;
boost::filesystem::path exe = master_test_suite().argv[1];
boost::process::filesystem::path exe = master_test_suite().argv[1];
std::error_code ec;
bp::child c(
@@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(run_exe_success)
#if defined(BOOST_WINDOWS_API)
BOOST_AUTO_TEST_CASE(run_exe_error)
{
boost::filesystem::path exe = "doesnt-exist";
boost::process::filesystem::path exe = "doesnt-exist";
std::error_code ec;
bp::child c(

View File

@@ -10,11 +10,11 @@
#define BOOST_TEST_MAIN
#include <boost/test/included/unit_test.hpp>
#include <boost/process/search_path.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/process/filesystem.hpp>
#include <string>
namespace bp = boost::process;
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
BOOST_AUTO_TEST_CASE(search_path)
{

View File

@@ -7,6 +7,7 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_TEST_MAIN
#define BOOST_TEST_IGNORE_SIGCHLD
#include <boost/test/included/unit_test.hpp>
@@ -23,6 +24,7 @@
namespace bp = boost::process;
BOOST_AUTO_TEST_CASE(shell_simple, *boost::unit_test::timeout(5))
{
using boost::unit_test::framework::master_test_suite;
@@ -48,6 +50,8 @@ BOOST_AUTO_TEST_CASE(shell_simple, *boost::unit_test::timeout(5))
BOOST_TEST_CHECKPOINT("Finished read");
BOOST_CHECK_EQUAL(s, "hello");
c.wait();
BOOST_CHECK_EQUAL(c.exit_code(), 0);
}
BOOST_AUTO_TEST_CASE(shell_error, *boost::unit_test::timeout(5))
@@ -61,3 +65,4 @@ BOOST_AUTO_TEST_CASE(shell_error, *boost::unit_test::timeout(5))
c2.wait();
BOOST_CHECK(c2.exit_code() != 0);
}

View File

@@ -10,7 +10,7 @@
#define BOOST_TEST_MAIN
#include <boost/test/included/unit_test.hpp>
#include <boost/process/shell.hpp>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <system_error>
namespace bp = boost::process;
@@ -18,13 +18,13 @@ namespace bp = boost::process;
BOOST_AUTO_TEST_CASE(shell_set_on_error)
{
std::error_code ec;
boost::filesystem::path p = bp::shell(ec);
boost::process::filesystem::path p = bp::shell(ec);
BOOST_CHECK(!ec);
BOOST_CHECK(boost::filesystem::exists(p));
BOOST_CHECK(boost::process::filesystem::exists(p));
}
BOOST_AUTO_TEST_CASE(shell_throw_on_error)
{
BOOST_CHECK_NO_THROW(bp::shell());
BOOST_CHECK(boost::filesystem::exists(bp::shell()));
BOOST_CHECK(boost::process::filesystem::exists(bp::shell()));
}

View File

@@ -10,7 +10,7 @@
#define BOOST_USE_WINDOWS_H
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/algorithm/transform.hpp>
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
}
else if (vm["pwd"].as<bool>())
{
std::cout << boost::filesystem::current_path().string() << std::endl;
std::cout << boost::process::filesystem::current_path().string() << std::endl;
}
else if (vm.count("query"))
{

View File

@@ -24,7 +24,7 @@
#include <boost/process/async.hpp>
#include <system_error>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <string>
#include <istream>
@@ -38,7 +38,7 @@ typedef boost::asio::windows::stream_handle pipe_end;
typedef boost::asio::posix::stream_descriptor pipe_end;
#endif
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
namespace bp = boost::process;
BOOST_AUTO_TEST_CASE(sync_spawn, *boost::unit_test::timeout(5))

View File

@@ -20,7 +20,7 @@
#include <boost/process/async.hpp>
#include <system_error>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <string>
#include <istream>
@@ -34,7 +34,7 @@ typedef boost::asio::windows::stream_handle pipe_end;
typedef boost::asio::posix::stream_descriptor pipe_end;
#endif
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
namespace bp = boost::process;
int main()

View File

@@ -12,7 +12,7 @@
#include <boost/test/included/unit_test.hpp>
#include <boost/process.hpp>
#include <boost/system/error_code.hpp>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <boost/algorithm/string/compare.hpp>
#include <string>
#include <iostream>
@@ -24,8 +24,8 @@ struct test_dir
{
std::string s_;
test_dir(const std::string &s) : s_(s)
{ BOOST_REQUIRE_NO_THROW(boost::filesystem::create_directory(s)); }
~test_dir() { boost::filesystem::remove(s_); }
{ BOOST_REQUIRE_NO_THROW(boost::process::filesystem::create_directory(s)); }
~test_dir() { boost::process::filesystem::remove(s_); }
};
BOOST_AUTO_TEST_CASE(start_in_dir)
@@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(start_in_dir)
std::error_code ec;
bp::child c(
bp::exe=boost::filesystem::absolute(master_test_suite().argv[1]).string(),
bp::exe=boost::process::filesystem::absolute(master_test_suite().argv[1]).string(),
bp::args +={"test", "--pwd"},
bp::start_dir = dir.s_,
bp::std_out>is,
@@ -49,8 +49,8 @@ BOOST_AUTO_TEST_CASE(start_in_dir)
std::string s;
std::getline(is, s);
auto path_read = boost::filesystem::absolute(boost::filesystem::path(s)).string();
auto path_set = boost::filesystem::absolute(dir.s_).string();
auto path_read = boost::process::filesystem::absolute(boost::process::filesystem::path(s)).string();
auto path_set = boost::process::filesystem::absolute(dir.s_).string();
if (path_read.size() > path_set.size())
path_read.resize(path_set.size());

View File

@@ -12,8 +12,8 @@
#include <cstdint>
#include <fstream>
#include <chrono>
#include <thread>
int main(int argc, char *argv[])

View File

@@ -28,7 +28,7 @@
#include <boost/process/async.hpp>
#include <system_error>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <string>
#include <chrono>
@@ -43,7 +43,7 @@ typedef boost::asio::windows::stream_handle pipe_end;
typedef boost::asio::posix::stream_descriptor pipe_end;
#endif
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
namespace bp = boost::process;
BOOST_AUTO_TEST_CASE(system_exit_code, *boost::unit_test::timeout(5))

View File

@@ -29,7 +29,7 @@
#include <boost/process/async.hpp>
#include <system_error>
#include <boost/filesystem.hpp>
#include <boost/process/filesystem.hpp>
#include <atomic>
#include <string>
@@ -37,7 +37,7 @@
#include <istream>
#include <cstdlib>
namespace fs = boost::filesystem;
namespace fs = boost::process::filesystem;
namespace bp = boost::process;
BOOST_AUTO_TEST_CASE(explicit_async_io, *boost::unit_test::timeout(2))

View File

@@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(wait_until)
auto now = std::chrono::system_clock::now();
auto t1 = now + std::chrono::milliseconds(400);
auto t2 = now + std::chrono::milliseconds(1200);
auto t2 = now + std::chrono::milliseconds(2000);
BOOST_CHECK(!c.wait_until(t1));
BOOST_CHECK( c.wait_until(t2));
@@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(wait_until_ec)
auto now = std::chrono::system_clock::now();
auto t1 = now + std::chrono::milliseconds(400);
auto t2 = now + std::chrono::milliseconds(1200);
auto t2 = now + std::chrono::milliseconds(2000);
BOOST_CHECK(!c.wait_until(t1, ec));
BOOST_CHECK( c.wait_until(t2, ec));