Skip to content

Commit

Permalink
Merge remote-tracking branch 'icymatter/ng' into ng
Browse files Browse the repository at this point in the history
  • Loading branch information
icymatter committed Jul 12, 2021
2 parents a55b7c4 + 64ced37 commit c7d99a1
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 7 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,18 @@ jobs:
export PATH="$(pwd -P):$PATH"
cd tests/
make test_pkgng
sun_tools:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build pacapt and tests
run: make pacapt.dev && mkdir -pv tests/tmp/ && cd tests && ruby -n ../bin/gen_tests.rb < sun_tools.txt > tmp/sun_tools.sh
- uses: vmactions/[email protected]
with:
run: |
set -x
ln -s pacapt.dev pacman
export PATH="$(pwd -P):$PATH"
cd tests/
make test_sun_tools
2 changes: 1 addition & 1 deletion bin/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ _check_POSIX_files() {
export SHELLCHECK_SHELL="sh"
while (( $# )); do
if awk 'NR==1' < "$1" \
| grep -Eiqe '^#!/usr/bin/env sh' ;
| grep -iq '^#!/usr/bin/env sh' ;
then
_check_file "$1" || return 1
# We only care POSIX issue for files under `lib/`
Expand Down
2 changes: 1 addition & 1 deletion bin/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ library_files() {
}

library_POSIX_ready() {
grep -Eqie '#!/usr/bin/env sh' -- "$@"
"$GREP" -qi '#!/usr/bin/env sh' -- "$@"
}

########################################################################
Expand Down
10 changes: 8 additions & 2 deletions bin/gen_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
puts ""
puts "set -u"
puts ""
puts ": \"${GGREP:=grep}\""
puts ""
puts "if [ \"$(uname)\" = \"SunOS\" ]; then"
puts " GGREP=ggrep"
puts "fi"
puts ""
#
# Just send message to STDERR
#
Expand Down Expand Up @@ -125,10 +131,10 @@
puts "N_TEST=$(( N_TEST + 1 ))"
puts "if [ -n \"${F_TMP:-}\" ]; then"
if expected.empty? or expected == "empty"
puts " ret=\"$(grep -Ec '.+' $F_TMP)\""
puts " ret=\"$(\"$GGREP\" -Ec '.+' $F_TMP)\""
puts " if [ -z \"$ret\" ] || [ \"$ret\" -ge 1 ]; then"
else
puts " ret=\"$(grep -Ec \"#{expected}\" $F_TMP)\""
puts " ret=\"$(\"$GGREP\" -Ec \"#{expected}\" $F_TMP)\""
puts " if [ -z \"$ret\" ] || [ \"$ret\" -eq 0 ]; then"
end
puts " _fail Expected \"#{expected}\""
Expand Down
7 changes: 7 additions & 0 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,10 @@ test_pkgng:
@ruby -n ../bin/gen_tests.rb < pkgng.txt > tmp/pkgng.sh
@pkg remove -y bash || true
@cd tmp && MSG_PREFIX=":: [pkgng] " sh pkgng.sh

# test_sun_tools:
# test_sun_tools: Execute SunOS tests within MacOS provided by Github-actions
.PHONY: test_sun_tools
test_sun_tools:
@set -u && echo $$CI >/dev/null
cd tmp && MSG_PREFIX=":: [sun_tools] " sh sun_tools.sh
2 changes: 1 addition & 1 deletion tests/dnf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ou ^Available Packages$
# Get information from local package file
in ! dnf repoquery --location nano
ou ^http.+\.rpm$
in ! curl -sL "$(dnf repoquery --location nano 2>/dev/null | head -n 1)" -o /tmp/nano-package.rpm
in ! curl -sL "$(dnf repoquery --location nano 2>/dev/null | head -n 1)" -o /tmp/nano-package.rpm --connect-timeout 5 --max-time 30 --retry 5 --retry-delay 0 --retry-max-time 60
ou empty
in ! [ -f /tmp/nano-package.rpm ] || echo not found
ou empty
Expand Down
2 changes: 1 addition & 1 deletion tests/pkgng.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ou not found

in -S --noconfirm nano
in clear
in -R --noconfirm nano
in -Rs --noconfirm nano
ou ^Installed packages to be REMOVED:$

# Fetch package
Expand Down
29 changes: 29 additions & 0 deletions tests/sun_tools.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

# Purpose : Testing script for sun_tools support
# Author : Álvaro Mondéjar
# License : MIT

# NOTE: Must be executed in a Solaris (SunOS) distribution

im solaris

# Get packages information
in -Qi
ou PKGINST:\s+CSWpkgutil
ou PKGINST:\s+BRCMbnx

# Get locally installed package
in -Qs pkgutil
ou ^application CSWpkgutil

# Get installed packages
in -Q
ou ^application CSWpkgutil

in -Q CSWpkgutil
ou ^application CSWpkgutil pkgutil

in -Qq
ou ^application CSWpkgutil

2 changes: 1 addition & 1 deletion tests/yum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ou ^(/usr)?/bin/repoquery$
# Get information from local package file
in ! repoquery --location nano
ou ^http.+\.rpm$
in ! curl -sL "$(repoquery --location nano 2>/dev/null | head -n 1)" -o /tmp/nano-package.rpm
in ! curl -sL "$(repoquery --location nano 2>/dev/null | head -n 1)" -o /tmp/nano-package.rpm --connect-timeout 5 --max-time 30 --retry 5 --retry-delay 0 --retry-max-time 60
ou empty
in ! [ -f /tmp/nano-package.rpm ] || echo not found
ou empty
Expand Down

0 comments on commit c7d99a1

Please sign in to comment.