sync code with last fixes and improvements from OpenBSD
This commit is contained in:
parent
8f31919cdb
commit
25f3a6cfac
76 changed files with 1289 additions and 694 deletions
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile,v 1.46 2021/03/09 17:38:24 martijn Exp $
|
||||
# $OpenBSD: Makefile,v 1.47 2023/06/12 20:19:45 millert Exp $
|
||||
|
||||
SUBDIR+= apply
|
||||
SUBDIR+= basename bc
|
||||
|
@ -12,7 +12,7 @@ SUBDIR+= m4 mail mandoc
|
|||
SUBDIR+= nc
|
||||
SUBDIR+= openssl
|
||||
SUBDIR+= rev
|
||||
SUBDIR+= sdiff sed signify snmp sort
|
||||
SUBDIR+= sdiff sed seq signify snmp sort
|
||||
SUBDIR+= tsort
|
||||
SUBDIR+= ul
|
||||
SUBDIR+= wc
|
||||
|
|
7
regress/usr.bin/seq/Makefile
Normal file
7
regress/usr.bin/seq/Makefile
Normal file
|
@ -0,0 +1,7 @@
|
|||
# $OpenBSD: Makefile,v 1.1 2023/06/12 20:19:45 millert Exp $
|
||||
|
||||
SEQ?= /usr/bin/seq
|
||||
|
||||
seqtest:
|
||||
sh ${.CURDIR}/$@.sh ${SEQ} $@.out
|
||||
diff ${.CURDIR}/$@.expected $@.out
|
62
regress/usr.bin/seq/seqtest.expected
Normal file
62
regress/usr.bin/seq/seqtest.expected
Normal file
|
@ -0,0 +1,62 @@
|
|||
Test 1.1: check for invalid format string
|
||||
seq: invalid format string: `foo'
|
||||
|
||||
Test 1.2: check for valid format string
|
||||
bar1.000000
|
||||
bar2.000000
|
||||
bar3.000000
|
||||
|
||||
Test 1.3: check for invalid increment
|
||||
seq: zero decrement
|
||||
|
||||
Test 1.4: check for first > last
|
||||
seq: needs negative decrement
|
||||
|
||||
Test 1.5: check for increment mismatch
|
||||
seq: needs positive increment
|
||||
|
||||
Test 1.6: check for increment mismatch
|
||||
seq: needs negative decrement
|
||||
|
||||
Test 2.0: single argument (0)
|
||||
1
|
||||
0
|
||||
|
||||
Test 2.1: single argument (1)
|
||||
1
|
||||
|
||||
Test 2.2: single argument (-1)
|
||||
1
|
||||
0
|
||||
-1
|
||||
|
||||
Test 2.3: two arguments (1, 1)
|
||||
1
|
||||
|
||||
Test 2.3: two arguments (1, 2)
|
||||
1
|
||||
2
|
||||
|
||||
Test 2.3: two arguments (1, -2)
|
||||
1
|
||||
0
|
||||
-1
|
||||
-2
|
||||
|
||||
Test 3.0: check for missing element due to rounding
|
||||
1
|
||||
1.1
|
||||
1.2
|
||||
|
||||
Test 3.1: check for missing element due to rounding
|
||||
0
|
||||
1e-06
|
||||
2e-06
|
||||
3e-06
|
||||
|
||||
Test 3.2: check for extra element due to rounding
|
||||
0.1
|
||||
1.09
|
||||
|
||||
Test 3.3: check for extra element due to rounding check
|
||||
1.05e+06
|
94
regress/usr.bin/seq/seqtest.sh
Executable file
94
regress/usr.bin/seq/seqtest.sh
Executable file
|
@ -0,0 +1,94 @@
|
|||
#!/bin/sh
|
||||
# $OpenBSD: seqtest.sh,v 1.1 2023/06/12 20:19:45 millert Exp $
|
||||
#
|
||||
# Public domain, 2023, Todd C. Miller <millert@openbsd.org>
|
||||
#
|
||||
# Usage: seqtest.sh [seq_bin log_file]
|
||||
#
|
||||
# If no log file is specified, seq.out is used.
|
||||
|
||||
run_tests()
|
||||
{
|
||||
SEQ=$1
|
||||
LOG=$2
|
||||
rm -f $LOG
|
||||
exec >$LOG 2>&1
|
||||
|
||||
test_args;
|
||||
test_simple;
|
||||
test_rounding;
|
||||
}
|
||||
|
||||
test_args()
|
||||
{
|
||||
echo 'Test 1.1: check for invalid format string'
|
||||
${SEQ} -f foo 3
|
||||
|
||||
echo
|
||||
echo 'Test 1.2: check for valid format string'
|
||||
${SEQ} -f bar%f 3
|
||||
|
||||
echo
|
||||
echo 'Test 1.3: check for invalid increment'
|
||||
${SEQ} 1 0 1
|
||||
|
||||
echo
|
||||
echo 'Test 1.4: check for first > last'
|
||||
${SEQ} 1 .1 -1
|
||||
|
||||
echo
|
||||
echo 'Test 1.5: check for increment mismatch'
|
||||
${SEQ} 0 -0.1 1
|
||||
|
||||
echo
|
||||
echo 'Test 1.6: check for increment mismatch'
|
||||
${SEQ} 1 0.1 0
|
||||
}
|
||||
|
||||
test_simple()
|
||||
{
|
||||
echo
|
||||
echo 'Test 2.0: single argument (0)'
|
||||
${SEQ} 0
|
||||
|
||||
echo
|
||||
echo 'Test 2.1: single argument (1)'
|
||||
${SEQ} 1
|
||||
|
||||
echo
|
||||
echo 'Test 2.2: single argument (-1)'
|
||||
${SEQ} -1
|
||||
|
||||
echo
|
||||
echo 'Test 2.3: two arguments (1, 1)'
|
||||
${SEQ} 1 1
|
||||
|
||||
echo
|
||||
echo 'Test 2.3: two arguments (1, 2)'
|
||||
${SEQ} 1 2
|
||||
|
||||
echo
|
||||
echo 'Test 2.3: two arguments (1, -2)'
|
||||
${SEQ} 1 -2
|
||||
}
|
||||
|
||||
test_rounding()
|
||||
{
|
||||
echo
|
||||
echo 'Test 3.0: check for missing element due to rounding'
|
||||
${SEQ} 1 0.1 1.2
|
||||
|
||||
echo
|
||||
echo 'Test 3.1: check for missing element due to rounding'
|
||||
${SEQ} 0 0.000001 0.000003
|
||||
|
||||
echo
|
||||
echo 'Test 3.2: check for extra element due to rounding'
|
||||
${SEQ} 0.1 .99 1.99
|
||||
|
||||
echo
|
||||
echo 'Test 3.3: check for extra element due to rounding check'
|
||||
${SEQ} 1050000 1050000
|
||||
}
|
||||
|
||||
run_tests ${1:-seq} ${2:-seq.out}
|
|
@ -62,7 +62,7 @@ setsprint:
|
|||
pkgpaths:
|
||||
${PERLSCRIPT}/check-path
|
||||
|
||||
signatures:
|
||||
signatures:
|
||||
-rm -f signatures.out
|
||||
${PERLSCRIPT}/check-sig 2>signatures.out
|
||||
diff -u signatures.out ${.CURDIR}/signatures.ref
|
||||
|
@ -351,7 +351,7 @@ rep0/inta-0.tgz:
|
|||
@${CREATE_PKG} -P't/intb:intb-*:intb-0' ${EMPTY} $@
|
||||
rep0/intb-0.tgz:
|
||||
@${CREATE_PKG} -P't/inta:inta-*:inta-0' ${EMPTY} $@
|
||||
|
||||
|
||||
rep1/o-1.tgz:
|
||||
@${CREATE_PKG} -DREGRESSION_TESTING -P't/p:p-*:p-0' -W'coincoin.0.0' ${EMPTY} $@
|
||||
|
||||
|
@ -376,10 +376,10 @@ rep0/p4-0.tgz: plist12
|
|||
rep1/p4-1.tgz: plist12
|
||||
@${WITH} -B src31 -DLIBa_VERSION=1.0 -f plist12 $@ ${CPKG}
|
||||
|
||||
rep0/boost-0.tgz:
|
||||
rep0/boost-0.tgz:
|
||||
@${CREATE_PKG} -DREGRESSION_TESTING -W'a.0.0' -P't/p4:p4-*:p4-0' ${EMPTY} $@
|
||||
|
||||
rep1/boost-0.tgz:
|
||||
|
||||
rep1/boost-0.tgz:
|
||||
@${CREATE_PKG} -DREGRESSION_TESTING -W'a.1.0' -P't/p4:p4-*:p4-1' ${EMPTY} $@
|
||||
|
||||
rep0/Imath-0.tgz:
|
||||
|
@ -489,10 +489,10 @@ rep0/g-0.tgz: plist4
|
|||
rep1/g-0.tgz: plist4
|
||||
@PACKAGE_COMMENT=updated ${CREATE_PKG} -f plist4 $@
|
||||
|
||||
rep0/gg-0.tgz: plist4
|
||||
rep0/gg-0.tgz: plist4
|
||||
@${CREATE_PKG} -P't/g:g-*:g-1' -f plist4 $@
|
||||
|
||||
rep1/gg-0.tgz: plist4
|
||||
rep1/gg-0.tgz: plist4
|
||||
@PACKAGE_COMMENT=updated ${CREATE_PKG} -P't/g:g-*:g-0' -f plist4 $@
|
||||
|
||||
rep1/gd-1.tgz rep1/ge-1.tgz: plist5
|
||||
|
@ -540,7 +540,7 @@ plist-rep1-$n:
|
|||
@${MKPLIST} "@conflict q1-0" "@conflict q2-0" "@conflict q3-0" "@conflict q4-0" "@exec echo 1>&2 'XXXrep1 $n'" >$@
|
||||
|
||||
.endfor
|
||||
|
||||
|
||||
rep0/q6-0.tgz:
|
||||
@${CREATE_PKG} -P't/q3:q3-*:q3-0' ${EMPTY} $@
|
||||
|
||||
|
@ -713,12 +713,12 @@ temp-error1: rep0/a-0.tgz rep0/b-0.tgz temp1.ref
|
|||
@{ INJECT=inject-temp1 ROOT=${D40} SILENT=1 ${ADD_PKG} rep0/a-0.tgz 1>/dev/null|| echo $$? ; } 2>&1|${SED_PIPE} >temp1.out
|
||||
@diff -u temp1.out ${.CURDIR}/temp1.ref
|
||||
|
||||
temp-error2:
|
||||
temp-error2:
|
||||
@-rm -rf ${XXXD}
|
||||
@{ INJECT=inject-temp2 ROOT=${XXXD} SILENT=1 PKG_PATH=https://www.google.com/ ${ADD_PKG} rep0/a-0.tgz 1>/dev/null|| echo $$? ; } 2>&1|${SED_PIPE2} >${XXXBASE}.out
|
||||
@diff -u ${XXXBASE}.out ${.CURDIR}/temp2.ref
|
||||
|
||||
temp-error2-as-root:
|
||||
temp-error2-as-root:
|
||||
@# XXX thx tedu for not allowing env thru
|
||||
@${SUDO} make -C ${.CURDIR} temp-error2 XXXBASE=temp2bis XXXD=${D41}
|
||||
|
||||
|
@ -768,7 +768,7 @@ rep6/avahi-0.tgz: plist25
|
|||
rep6/cups-0.tgz:
|
||||
@${CREATE_PKG} -DREGRESSION_TESTING -P't/avahi:avahi-*:avahi-0' -W avahi.0.0 ${EMPTY} $@
|
||||
|
||||
rep7/avahi-1.tgz:
|
||||
rep7/avahi-1.tgz:
|
||||
@${CREATE_PKG} -DREGRESSION_TESTING -P't/avahi-libs:avahi-libs-*:avahi-libs-1' ${EMPTY} $@
|
||||
|
||||
rep7/avahi-libs-1.tgz: plist27
|
||||
|
|
|
@ -30,7 +30,7 @@ sub wrap
|
|||
my ($name, $sub) = @_;
|
||||
my $typeglob = caller()."::$name";
|
||||
my $original;
|
||||
{
|
||||
{
|
||||
no strict qw(refs);
|
||||
$original = *$typeglob{CODE};
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ sub wrap
|
|||
return &$sub($original, @_);
|
||||
};
|
||||
|
||||
{
|
||||
{
|
||||
no strict qw(refs);
|
||||
no warnings qw(redefine);
|
||||
*{$typeglob} = $imposter;
|
||||
|
|
|
@ -57,7 +57,7 @@ sub check_print
|
|||
|
||||
my $u1 = create_set([qw(cups-2.9 cups-libs-2.9 mupdf-2.5)], [qw(mupdf-2.5 cups-3.1 cups-libs-3.1)]);
|
||||
|
||||
ok(check_print($u1,
|
||||
ok(check_print($u1,
|
||||
'cups-2.9+cups-libs-2.9+mupdf-2.5->cups-3.1+cups-libs-3.1+mupdf-2.5'));
|
||||
|
||||
$u1->move_kept(OpenBSD::Handle->create_old('mupdf-2.5', $state));
|
||||
|
|
|
@ -17,7 +17,7 @@ sub check_list
|
|||
my @r = sort(@$expected);
|
||||
@_ = sort(@_);
|
||||
if (@r != @_) {
|
||||
print STDERR "length: ", scalar(@r)," vs. ",
|
||||
print STDERR "length: ", scalar(@r)," vs. ",
|
||||
scalar(@_), "\n";
|
||||
print STDERR "Expected: ", join(',', @r), "\n";
|
||||
print STDERR "Result: ", join(',', @_), "\n";
|
||||
|
|
|
@ -12,7 +12,7 @@ sub check_list
|
|||
my $expected = shift;
|
||||
@_ = sort(@_);
|
||||
if (@$expected != @_) {
|
||||
print STDERR "length: ", scalar(@$expected)," vs. ",
|
||||
print STDERR "length: ", scalar(@$expected)," vs. ",
|
||||
scalar(@_), "\n";
|
||||
print STDERR join(',', @$expected), "\n";
|
||||
print STDERR join(',', @_), "\n";
|
||||
|
@ -62,29 +62,29 @@ sub check_order
|
|||
}
|
||||
|
||||
@list = qw(py-MxDateTime-2.0.1-py2.1);
|
||||
ok(check_list(\@list,
|
||||
ok(check_list(\@list,
|
||||
check_pkgspec('py-MxDateTime->=2.0-py2.1', @list)),
|
||||
'flavor with number');
|
||||
@list = qw(foo-1.0 foo-1.0p0 foo-1.0p25);
|
||||
ok(check_list([qw(foo-1.0)],
|
||||
ok(check_list([qw(foo-1.0)],
|
||||
check_pkgspec('foo-<1.0p0', @list)),
|
||||
'before 1.0p0 came 1.0');
|
||||
ok(check_list([qw(foo-1.0 foo-1.0p0)],
|
||||
ok(check_list([qw(foo-1.0 foo-1.0p0)],
|
||||
check_pkgspec('foo-<=1.0p0', @list)),
|
||||
'1.0 and 1.0p0 both match <=1.0p0');
|
||||
'1.0 and 1.0p0 both match <=1.0p0');
|
||||
ok(check_list([qw(foo-1.0 foo-1.0p0 foo-1.0p25)],
|
||||
check_pkgspec('foo-1.0', @list)),
|
||||
'any 1.0p* matches 1.0');
|
||||
@list = qw(foo-1.0rc2);
|
||||
ok(check_list(\@list,
|
||||
check_pkgspec('foo-<1.0', @list)),
|
||||
'before 1.0 came 1.0rc2');
|
||||
check_pkgspec('foo-<1.0', @list)),
|
||||
'before 1.0 came 1.0rc2');
|
||||
@list = qw(foo-1.0);
|
||||
ok(check_list(\@list,
|
||||
check_pkgspec('foo-<1.0pl1', @list)),
|
||||
'before 1.0pl1 came 1.0');
|
||||
check_pkgspec('foo-<1.0pl1', @list)),
|
||||
'before 1.0pl1 came 1.0');
|
||||
|
||||
my @pkglist=qw(foo-1.0 bar-2.0 foo-2.5 foobar-2.3-pouet hugs-noversion baz-0.0
|
||||
my @pkglist=qw(foo-1.0 bar-2.0 foo-2.5 foobar-2.3-pouet hugs-noversion baz-0.0
|
||||
baz-1.1 baz-25.3 pouet-1.0 pouet-zoinx-1.0 pouet-0.0-foo);
|
||||
|
||||
my $hash = OpenBSD::PackageName::compile_stemlist(@pkglist);
|
||||
|
@ -111,9 +111,9 @@ ok(check_list([qw(hugs-noversion)],
|
|||
$hash->find('hugs-noversion')),
|
||||
'stem matching with no version');
|
||||
ok(OpenBSD::PackageName->from_string('foo-1.0-f2-f1')->to_string
|
||||
eq 'foo-1.0-f1-f2',
|
||||
eq 'foo-1.0-f1-f2',
|
||||
'canonical names');
|
||||
ok(!OpenBSD::Search::PkgSpec->new('foo-<>1.5')->is_valid,
|
||||
ok(!OpenBSD::Search::PkgSpec->new('foo-<>1.5')->is_valid,
|
||||
'invalid spec');
|
||||
|
||||
ok(check_list(["is a stem"], check_name("pkgname-without-version")),
|
||||
|
|
|
@ -39,7 +39,7 @@ my @p = (
|
|||
make_plist('p1'), # 1
|
||||
make_plist('p2'), # 2
|
||||
make_plist('p2', 'p1'), # 3
|
||||
make_plist('p3', 'p1'), # 4
|
||||
make_plist('p3', 'p1'), # 4
|
||||
make_plist('p4,flavor'), # 5
|
||||
make_plist('newp4', 'p4,flavor'), # 6
|
||||
make_plist('newp4', 'p4,otherflavor'), # 7
|
||||
|
|
|
@ -8,7 +8,7 @@ use OpenBSD::Temp;
|
|||
package OpenBSD::Temp;
|
||||
use Wrapper;
|
||||
|
||||
wrap('permanent_dir',
|
||||
wrap('permanent_dir',
|
||||
sub {
|
||||
my $original = shift;
|
||||
$_[0] = "/nonexistent";
|
||||
|
|
|
@ -8,7 +8,7 @@ use OpenBSD::Temp;
|
|||
package OpenBSD::Temp;
|
||||
use Wrapper;
|
||||
|
||||
wrap('permanent_file',
|
||||
wrap('permanent_file',
|
||||
sub {
|
||||
my $original = shift;
|
||||
$_[0] = "/nonexistent";
|
||||
|
|
|
@ -8,7 +8,7 @@ use OpenBSD::Temp;
|
|||
package OpenBSD::Temp;
|
||||
use Wrapper;
|
||||
|
||||
wrap('permanent_file',
|
||||
wrap('permanent_file',
|
||||
sub {
|
||||
my $original = shift;
|
||||
$_[0] = "/nonexistent";
|
||||
|
|
|
@ -32,7 +32,7 @@ if (!defined $pkgpath) {
|
|||
}
|
||||
|
||||
my @l;
|
||||
push(@l,
|
||||
push(@l,
|
||||
'-p', $ENV{'PACKAGE_BASE'} || '/usr/local',
|
||||
"-DFULLPKGPATH=$pkgpath",
|
||||
'-DMAINTAINER=regress-tests',
|
||||
|
@ -40,7 +40,7 @@ push(@l,
|
|||
'-DSHARED_LIBS=1',
|
||||
'-d', $ENV{'PACKAGE_DESCR'} || '-descr',
|
||||
'-A', $ENV{'PACKAGE_ARCH'} || '*');
|
||||
|
||||
|
||||
|
||||
my @args = ('pkg_create', @l, @ARGV, $target);
|
||||
print join(' ', @args), "\n" if $ENV{'VERBOSE'};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue