mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-09-11 05:35:53 +03:00
Standardised shell scripts shebang and error handling
This commit is contained in:
parent
ed2b31ebb1
commit
662ec8184e
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
set -Eeuo pipefail
|
||||
|
||||
time hurl tests/hello_1000.hurl
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
color_red=$(echo -e "\033[1;31m")
|
||||
color_reset=$(echo -e "\033[0m")
|
||||
errors_count=0
|
||||
|
||||
# Check that Rust source files contains Orange Copyright
|
||||
find packages -name "*.rs" | while read -r rust_file; do
|
||||
@ -9,4 +13,3 @@ find packages -name "*.rs" | while read -r rust_file; do
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
black --check .
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
# Check that issues in CHANGELOG are up-to-to-date
|
||||
set -eu
|
||||
|
||||
version=$(head -1 <CHANGELOG.md| cut -d" " -f1 | cut -d'[' -f2)
|
||||
changelog=$(bin/release/changelog_extract.py "$version" | grep '^\* ')
|
||||
@ -12,5 +12,3 @@ if [ "$changelog" != "$issues" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
cargo clippy -- -D warnings
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
get_sample_crate_version() {
|
||||
crate="$1"
|
||||
@ -49,4 +49,5 @@ cd contrib/sample
|
||||
cargo clean
|
||||
cargo update
|
||||
cargo build
|
||||
cargo run -- hello.hurl
|
||||
cargo run -- hello.hurl
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
bin/update_crates.sh --check
|
||||
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
docker_file="$1"
|
||||
version="2.12.0"
|
||||
wget --quiet --output-document /tmp/hadolint "https://github.com/hadolint/hadolint/releases/download/v${version}/hadolint-Linux-x86_64"
|
||||
chmod +x /tmp/hadolint
|
||||
/tmp/hadolint --verbose "${docker_file}"
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
bin/install_rust_latest.sh
|
||||
pip3 install -r bin/requirements-frozen.txt
|
||||
sudo apt update && sudo apt install -y libxml2-utils
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
cargo fmt --all -- --check
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
find . -type f -name '*.sh' -print0 | xargs -0 shellcheck
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
xmllint --noout integration/tests_*/*.html
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
uname -a
|
||||
python3 -V
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
cargo install grcov
|
||||
rustup component add llvm-tools-preview
|
||||
cargo clean
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo "----- install prerequisite packages -----"
|
||||
apk update --quiet
|
||||
apk add --quiet bash curl curl-dev build-base libffi-dev libxml2-dev libxml2-utils openssl-dev python3 python3-dev py3-pip
|
||||
|
||||
python3 -m pip install --upgrade pip --quiet
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo "----- install prerequisite packages -----"
|
||||
pacman -Syy --noconfirm
|
||||
pacman -Sy --noconfirm bash curl icu base-devel libxml2 python3 glibc
|
||||
|
||||
curl -O https://bootstrap.pypa.io/get-pip.py
|
||||
python3 get-pip.py
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
# Install packages
|
||||
pacman -Syy --noconfirm
|
||||
pacman -Sy --noconfirm bash python3 python-pip
|
||||
python3 -m pip install --upgrade pip --quiet
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
# Install packages
|
||||
yum install -y bash python3-devel python3-pip
|
||||
python3 -m pip install --upgrade pip --quiet
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
# Install packages
|
||||
apt update
|
||||
apt -y install bash curl sudo libcurl4-openssl-dev libxml2-utils libxml2-dev libssl-dev python3 python3-pip
|
||||
python3 -m pip install --upgrade pip --quiet
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo "----- install prerequisite packages -----"
|
||||
yum install -y bash procps gcc libxml2-devel openssl-devel libcurl-devel python3-devel python3-pip
|
||||
python3 -m pip install --upgrade pip --quiet
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
sudo apt update
|
||||
# Install libcurl dev so that hurl can be built dynamically with libcurl
|
||||
sudo apt install bash libcurl4-openssl-dev libxml2-utils
|
||||
python3 -m pip install --upgrade pip --quiet
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
|
||||
sh rustup.sh -y
|
||||
# shellcheck source=/dev/null
|
||||
@ -8,4 +9,3 @@ export PATH
|
||||
rustc --version
|
||||
cargo --version
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -u
|
||||
set -Eeuo pipefail
|
||||
|
||||
sudo rm -rf target/debian
|
||||
mkdir target/debian
|
||||
mkdir -p target/debian/usr/bin target/debian/DEBIAN
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -u
|
||||
set -Eeuo pipefail
|
||||
|
||||
os="$1"
|
||||
package_dir="target/tarball/hurl-$VERSION"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
# Get hurl source version
|
||||
VERSION="$(grep '^version' packages/hurl/Cargo.toml | cut -f2 -d'"')"
|
||||
echo "${VERSION}"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo "----- install deb package -----"
|
||||
|
||||
@ -14,3 +14,4 @@ dpkg -x "${deb_package}" "${install_dir}"
|
||||
package_dir="${install_dir}/usr/bin"
|
||||
echo "Run this if you want to use fresh builded hurl package:"
|
||||
echo " export PATH=$package_dir:$PATH"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo "----- install generic linux package -----"
|
||||
|
||||
@ -12,3 +12,4 @@ tar xvf "${generic_linux_package}" -C "${install_dir}" --strip-components=1
|
||||
# Return PATH var to parent shell
|
||||
echo "Run this if you want to use fresh builded hurl package:"
|
||||
echo " export PATH=${install_dir}:$PATH"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo "----- install generic macos package -----"
|
||||
|
||||
@ -13,3 +13,4 @@ tar xvf "${generic_macos_package}" -C "${install_dir}" --strip-components=1
|
||||
# Return PATH var to parent shell
|
||||
echo "Run this if you want to use fresh builded hurl package:"
|
||||
echo " export PATH=${install_dir}:$PATH"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
rm -rf target/man
|
||||
mkdir -p target/man
|
||||
@ -9,4 +9,3 @@ bin/release/gen_manpage.py docs/manual/hurlfmt.md > target/man/hurlfmt.1
|
||||
gzip -n -9 target/man/hurl.1
|
||||
gzip -n -9 target/man/hurlfmt.1
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
PATH="$HOME"/.cargo/bin:$PATH
|
||||
export PATH
|
||||
@ -9,3 +9,4 @@ cargo build --release --verbose --locked
|
||||
package_dir="$(cd target/release ; pwd)"
|
||||
echo "Run this if you want to use fresh builded hurl package:"
|
||||
echo " export PATH=$package_dir:$PATH"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo "----- Bench suite -----"
|
||||
|
||||
@ -16,3 +16,4 @@ python3 server.py >server.log 2>&1 &
|
||||
sleep 5
|
||||
netstat -anpe | grep 8000
|
||||
./run.sh
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
"$(dirname "$0")"/test_prerequisites.sh
|
||||
"$(dirname "$0")"/test_unit.sh
|
||||
export PATH="${PWD}/target/release:$PATH"
|
||||
"$(dirname "$0")"/test_integ.sh
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo "----- integration tests -----"
|
||||
|
||||
@ -16,3 +16,4 @@ cd integration || exit
|
||||
./test_html_output.py tests_ok/*.html tests_failed/*.html
|
||||
./ad_hoc.sh
|
||||
./report.py
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo "----- install servers prerequisites -----"
|
||||
pip3 install --requirement bin/requirements-frozen.txt
|
||||
echo "----- start servers -----"
|
||||
@ -8,4 +9,3 @@ python3 server.py >server.log 2>&1 &
|
||||
python3 ssl/server.py >server-ssl.log 2>&1 &
|
||||
mitmdump --listen-host 127.0.0.1 --listen-port 8888 --modify-header "/From-Proxy/Hello" >mitmdump.log 2>&1 &
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo "----- unit tests -----"
|
||||
PATH="$HOME"/.cargo/bin:$PATH
|
||||
export PATH
|
||||
@ -9,3 +10,4 @@ cargo test --release --features strict --tests
|
||||
package_dir="$(cd target/release ; pwd)"
|
||||
echo "Run this if you want to use fresh builded hurl package:"
|
||||
echo " export PATH=$package_dir:$PATH"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
# init exit workflow
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
# init colors
|
||||
color_red=$(echo -ne "\033[1;31m")
|
||||
@ -131,3 +131,4 @@ main() {
|
||||
|
||||
# run
|
||||
main "$@"
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
set -Eeuo pipefail
|
||||
|
||||
# Check version
|
||||
# A specific version defines both the grammar format and the HTML output
|
||||
@ -15,4 +14,5 @@ fi
|
||||
cat <<END >hurl.grammar.html
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
END
|
||||
grammar <hurl.grammar >>hurl.grammar.html
|
||||
grammar <hurl.grammar >>hurl.grammar.html
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
# Add ad-hoc tests that can't be easily added in tests_ok/ nor tests_failed/
|
||||
|
||||
function assert_equals() {
|
||||
@ -29,3 +31,4 @@ echo "Check hurlfmt --color"
|
||||
actual=$(echo 'GET http://localhost:8000/hello' | hurlfmt --color)
|
||||
expected="[33mGET[0m [32mhttp://localhost:8000/hello[0m"
|
||||
assert_equals "$actual" "$expected"
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -Eeuo pipefail
|
||||
|
||||
find ./tests_ok ./tests_failed -maxdepth 1 -type f -name '*.curl' ! -name '*windows*'|sort | while read -r f; do
|
||||
echo "** $f"
|
||||
grep -v '^$' <"$f" | grep -v '^#' | while read -r line; do
|
||||
@ -11,3 +12,4 @@ find ./tests_ok ./tests_failed -maxdepth 1 -type f -name '*.curl' ! -name '*wind
|
||||
done
|
||||
|
||||
echo "all curl commands have been run with success!"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user