Files
galaxy/script/macos/test_create_galaxyctrl_wrapper

43 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -e
workspace_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
temp_dir="$(mktemp -d)"
trap 'rm -rf "$temp_dir"' EXIT
bundle_dir="$temp_dir/Galaxy.app/Contents"
wrapper_path="$bundle_dir/Resources/bin/galaxyctrl-oss"
binary_path="$bundle_dir/MacOS/galaxy-oss"
installed_path="$temp_dir/usr/local/bin/galaxyctrl-oss"
forwarded_args_file="$temp_dir/forwarded-args"
expected_args_file="$temp_dir/expected-args"
mkdir -p "$(dirname "$binary_path")" "$(dirname "$installed_path")"
cat > "$binary_path" << 'EOF'
#!/bin/bash
printf '%s\n' "$@" > "$FORWARDED_ARGS_FILE"
EOF
chmod +x "$binary_path"
"$workspace_root/script/macos/create_galaxyctrl_wrapper" \
"$wrapper_path" \
"../../MacOS/galaxy-oss"
cat > "$expected_args_file" << 'EOF'
--galaxyctrl
tab
create
--instance
inst 123
EOF
FORWARDED_ARGS_FILE="$forwarded_args_file" \
"$wrapper_path" tab create --instance "inst 123"
cmp "$expected_args_file" "$forwarded_args_file"
ln -s "$wrapper_path" "$installed_path"
FORWARDED_ARGS_FILE="$forwarded_args_file" \
"$installed_path" tab create --instance "inst 123"
cmp "$expected_args_file" "$forwarded_args_file"