Importing NetBSD "Kyua" test framework

To do so, a few dependencies have been imported:

 * external/bsd/lutok
 * external/mit/lua
 * external/public-domain/sqlite
 * external/public-domain/xz

The Kyua framework is the new generation of ATF (Automated Test
Framework), it is composed of:

 * external/bsd/atf
 * external/bsd/kyua-atf-compat
 * external/bsd/kyua-cli
 * external/bsd/kyua-tester
 * tests

Kyua/ATF being written in C++, it depends on libstdc++ which is
provided by GCC. As this is not part of the sources, Kyua is only
compiled when the native GCC utils are installed.

To install Kyua do the following:

 * In a cross-build enviromnent, add the following to the build.sh
   commandline: -V MKBINUTILS=yes -V MKGCCCMDS=yes

WARNING:
  At this point the import is still experimental, and not supported
  on native builds (a.k.a make build).

Change-Id: I26aee23c5bbd2d64adcb7c1beb98fe0d479d7ada
This commit is contained in:
2013-02-26 09:24:42 +01:00
committed by Gerrit Code Review
parent 003ff52ebb
commit 11be35a165
2893 changed files with 502052 additions and 2630 deletions

View File

@@ -0,0 +1,34 @@
# $NetBSD: Makefile,v 1.2 2012/03/11 18:35:59 jruoho Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/usr.bin/awk
TESTS_SH= t_awk
NOMAN= # defined
FILESDIR= ${TESTSDIR}
FILES= d_big_regexp.awk
FILES+= d_big_regexp.in
FILES+= d_big_regexp.out
FILES+= d_end1.awk
FILES+= d_end1.in
FILES+= d_end1.out
FILES+= d_end2.awk
FILES+= d_end2.in
FILES+= d_end2.out
FILES+= d_period.awk
FILES+= d_period.in
FILES+= d_period.out
FILES+= d_string1.awk
FILES+= d_string1.out
FILES+= d_tolower.awk
FILES+= d_tolower.in
FILES+= d_tolower.out
FILES+= d_toupper.awk
FILES+= d_toupper.in
FILES+= d_toupper.out
FILES+= d_assign_NF.awk
FILES+= d_assign_NF.in
FILES+= d_assign_NF.out
.include <bsd.test.mk>

View File

@@ -0,0 +1,16 @@
# $NetBSD: d_assign_NF.awk,v 1.1 2012/03/11 18:35:59 jruoho Exp $
{
NF = 2
print "$0=`" $0 "`"
print "$3=`" $3 "`"
print "$4=`" $4 "`"
NF = 3
print "$0=`" $0 "`"
print "$3=`" $3 "`"
print "$4=`" $4 "`"
NF = 4
print "$0=`" $0 "`"
print "$3=`" $3 "`"
print "$4=`" $4 "`"
}

View File

@@ -0,0 +1 @@
1 2 3

View File

@@ -0,0 +1,9 @@
$0=`1 2`
$3=``
$4=``
$0=`1 2 `
$3=``
$4=``
$0=`1 2 `
$3=``
$4=``

View File

@@ -0,0 +1,3 @@
# $NetBSD: d_big_regexp.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
/^[^_][^ ]*_NNIFO([ ]+[^_]+[^ ]*_(CC|INR|JJFO|JJMA|JJPG|NNIFG|NNIFO|NNIMPG|NNIMR|NNING|PP3FD|PQINO|PQMO|PSFR|RQ|TC|VIIR3|VPIPN|VPLIPF|NOTAG|RQR))*$/

View File

@@ -0,0 +1 @@
1_NNIFO 1_PSFR 1_JJFO 1_NNIFO 1_INR 1_NNIMR 1_CC 1_NNING 1_RQ 1_VPLIPF 1_NNIFG 1_JJPG 1_NNIMPG 1_PQINO 1_VPIPN 1_PP3FD 1_JJMA 1_PQMO 1_TC 1_VIIR3

View File

@@ -0,0 +1 @@
1_NNIFO 1_PSFR 1_JJFO 1_NNIFO 1_INR 1_NNIMR 1_CC 1_NNING 1_RQ 1_VPLIPF 1_NNIFG 1_JJPG 1_NNIMPG 1_PQINO 1_VPIPN 1_PP3FD 1_JJMA 1_PQMO 1_TC 1_VIIR3

View File

@@ -0,0 +1,5 @@
# $NetBSD: d_end1.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
END {
print NF;
}

View File

@@ -0,0 +1 @@
a b c d

View File

@@ -0,0 +1 @@
4

View File

@@ -0,0 +1,5 @@
# $NetBSD: d_end2.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
END {
print $0;
}

View File

@@ -0,0 +1 @@
a b c d

View File

@@ -0,0 +1 @@
a b c d

View File

@@ -0,0 +1 @@
{print x + $1 + 0.125}

View File

@@ -0,0 +1 @@
0,25

View File

@@ -0,0 +1 @@
0.625

View File

@@ -0,0 +1,7 @@
# $NetBSD: d_string1.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
BEGIN {
print "A\
B";
print "CD"
}

View File

@@ -0,0 +1,2 @@
AB
CD

View File

@@ -0,0 +1,5 @@
# $NetBSD: d_tolower.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
END {
print tolower($0);
}

View File

@@ -0,0 +1 @@
ABCÆØÅ

View File

@@ -0,0 +1 @@
abcæøå

View File

@@ -0,0 +1,5 @@
# $NetBSD: d_toupper.awk,v 1.1 2012/03/11 18:36:01 jruoho Exp $
END {
print toupper($0);
}

View File

@@ -0,0 +1 @@
abcæøå

View File

@@ -0,0 +1 @@
ABCÆØÅ

378
tests/usr.bin/awk/t_awk.sh Normal file
View File

@@ -0,0 +1,378 @@
# $NetBSD: t_awk.sh,v 1.5 2012/12/10 20:30:06 christos Exp $
#
# Copyright (c) 2012 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Christos Zoulas
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
awk=awk
h_check()
{
local fname=d_$1
for sfx in in out awk; do
cp -r $(atf_get_srcdir)/$fname.$sfx .
done
shift 1
atf_check -o file:$fname.out -x "awk $@ -f $fname.awk < $fname.in"
}
atf_test_case big_regexp
big_regexp_head() {
atf_set "descr" "Checks matching long regular expressions (PR/33392)"
}
big_regexp_body() {
h_check big_regexp
}
atf_test_case end
end_head() {
atf_set "descr" "Checks that the last line of the input" \
"is available under END pattern (PR/29659)"
}
end_body() {
h_check end1
h_check end2
}
atf_test_case string1
string1_head() {
atf_set "descr" "Checks escaping newlines in string literals"
}
string1_body() {
for sfx in out awk; do
cp -r $(atf_get_srcdir)/d_string1.$sfx .
done
atf_check -o file:d_string1.out awk -f d_string1.awk
}
atf_test_case multibyte
multibyte_head() {
atf_set "descr" "Checks multibyte charsets support" \
"in tolower and toupper (PR/36394)"
}
multibyte_body() {
export LANG=en_US.UTF-8
h_check tolower
h_check toupper
}
atf_test_case period
period_head() {
atf_set "descr" "Checks that the period character is recognised" \
"in awk program regardless of locale (bin/42320)"
}
period_body() {
export LANG=ru_RU.KOI8-R
h_check period -v x=0.5
}
atf_test_case assign_NF
assign_NF_head() {
atf_set "descr" 'Checks that assign to NF changes $0 and $n (PR/44063)'
}
assign_NF_body() {
h_check assign_NF
}
atf_test_case single_char_rs
single_char_rs_head() {
atf_set "descr" "Test awk(1) with single character RS"
}
single_char_rs_body() {
atf_check \
-o "inline:1\n2\n\n3\n\n\n4\n\n" \
-x "echo 1a2aa3aaa4 | $awk 1 RS=a"
}
atf_test_case two_char_rs
two_char_rs_head() {
atf_set "descr" "Test awk(1) with two characters RS"
}
two_char_rs_body() {
atf_check \
-o "inline:1\n2\n3\n4\n\n" \
-x "echo 1ab2ab3ab4 | $awk 1 RS=ab"
}
atf_test_case single_char_regex_group_rs
single_char_regex_group_rs_head() {
atf_set "descr" "Test awk(1) with single character regex group RS"
}
single_char_regex_group_rs_body() {
atf_check \
-o "inline:1\n2\n\n3\n\n\n4\n\n" \
-x "echo 1a2aa3aaa4 | $awk 1 RS='[a]'"
}
atf_test_case two_char_regex_group_rs
two_char_regex_group_rs_head() {
atf_set "descr" "Test awk(1) with two characters regex group RS"
}
two_char_regex_group_rs_body() {
atf_check \
-o "inline:1\n2\n\n3\n\n\n4\n\n" \
-x "echo 1a2ab3aba4 | $awk 1 RS='[ab]'"
}
atf_test_case single_char_regex_star_rs
single_char_regex_star_rs_head() {
atf_set "descr" "Test awk(1) with single character regex star RS"
}
single_char_regex_star_rs_body() {
atf_check \
-o "inline:1\n2\n3\n4\n\n" \
-x "echo 1a2aa3aaa4 | $awk 1 RS='a*'"
}
atf_test_case two_char_regex_star_rs
two_char_regex_star_rs_head() {
atf_set "descr" "Test awk(1) with two characters regex star RS"
}
two_char_regex_star_rs_body() {
atf_check \
-o "inline:1\n2\n3\n4\n\n" \
-x "echo 1a2aa3aaa4 | $awk 1 RS='aa*'"
}
atf_test_case regex_two_star_rs
regex_two_star_rs_head() {
atf_set "descr" "Test awk(1) with regex two star RS"
}
regex_two_star_rs_body() {
atf_check \
-o "inline:1\n2\n3\n4\n\n" \
-x "echo 1a2ab3aab4 | $awk 1 RS='aa*b*'"
}
atf_test_case regex_or_1_rs
regex_or_1_rs_head() {
atf_set "descr" "Test awk(1) with regex | case 1 RS"
}
regex_or_1_rs_body() {
atf_check \
-o "inline:1a\nc\n\n" \
-x "echo 1abc | $awk 1 RS='abcde|b'"
}
atf_test_case regex_or_2_rs
regex_or_2_rs_head() {
atf_set "descr" "Test awk(1) with regex | case 2 RS"
}
regex_or_2_rs_body() {
atf_check \
-o "inline:1a\ncdf2\n\n" \
-x "echo 1abcdf2 | $awk 1 RS='abcde|b'"
}
atf_test_case regex_or_3_rs
regex_or_3_rs_head() {
atf_set "descr" "Test awk(1) with regex | case 3 RS"
}
regex_or_3_rs_body() {
atf_check \
-o "inline:1\n\nf2\n\n" \
-x "echo 1abcdebf2 | $awk 1 RS='abcde|b'"
}
atf_test_case regex_or_4_rs
regex_or_4_rs_head() {
atf_set "descr" "Test awk(1) with regex | case 4 RS"
}
regex_or_4_rs_body() {
atf_check \
-o "inline:1\nbcdf2\n\n" \
-x "echo 1abcdf2 | $awk 1 RS='abcde|a'"
}
atf_test_case regex_caret_1_rs
regex_caret_1_rs_head() {
atf_set "descr" "Test awk(1) with regex ^ case 1 RS"
}
regex_caret_1_rs_body() {
atf_check \
-o "inline:\n1a2a3a\n\n" \
-x "echo a1a2a3a | $awk 1 RS='^a'"
}
atf_test_case regex_caret_2_rs
regex_caret_2_rs_head() {
atf_set "descr" "Test awk(1) with regex ^ case 2 RS"
}
regex_caret_2_rs_body() {
atf_check \
-o "inline:\naa1a2a\n\n" \
-x "echo aaa1a2a | $awk 1 RS='^a'"
}
atf_test_case regex_dollar_1_rs
regex_dollar_1_rs_head() {
atf_set "descr" "Test awk(1) with regex $ case 1 RS"
}
regex_dollar_1_rs_body() {
atf_check \
-o "inline:a1a2a3a\n\n" \
-x "echo a1a2a3a | $awk 1 RS='a$'"
}
atf_test_case regex_dollar_2_rs
regex_dollar_2_rs_head() {
atf_set "descr" "Test awk(1) with regex $ case 2 RS"
}
regex_dollar_2_rs_body() {
atf_check \
-o "inline:a1a2aaa\n\n" \
-x "echo a1a2aaa | $awk 1 RS='a$'"
}
atf_test_case regex_reallocation_rs
regex_reallocation_rs_head() {
atf_set "descr" "Test awk(1) with regex reallocation RS"
}
regex_reallocation_rs_body() {
atf_check \
-o "inline:a\na\na\na\na\na\na\na\na\na10000\n\n" \
-x "jot -s a 10000 | $awk 'NR>1' RS='999[0-9]'"
}
atf_test_case empty_rs
empty_rs_head() {
atf_set "descr" "Test awk(1) with empty RS"
}
empty_rs_body() {
atf_check \
-o "inline:foo\n" \
-x "echo foo | $awk 1 RS=''"
}
atf_test_case newline_rs
newline_rs_head() {
atf_set "descr" "Test awk(1) with newline RS"
}
newline_rs_body() {
atf_check \
-o "inline:r1f1:r1f2\nr2f1:r2f2\n" \
-x "printf '\n\n\nr1f1\nr1f2\n\nr2f1\nr2f2\n\n\n' | $awk '{\$1=\$1}1' RS= OFS=:"
}
atf_test_case modify_subsep
modify_subsep_head() {
atf_set "descr" "Test awk(1) SUPSEP modification (PR/47306)"
}
modify_subsep_body() {
atf_check \
-o "inline:1\n1\n1\n" \
-x "printf '1\n1 2\n' | \
$awk '1{ arr[\$1 SUBSEP \$2 SUBSEP ++cnt[\$1]]=1} {for (f in arr) print arr[f];}'"
}
atf_init_test_cases() {
atf_add_test_case big_regexp
atf_add_test_case end
atf_add_test_case string1
atf_add_test_case multibyte
atf_add_test_case period
atf_add_test_case assign_NF
atf_add_test_case single_char_rs
atf_add_test_case two_char_rs
atf_add_test_case single_char_regex_group_rs
atf_add_test_case two_char_regex_group_rs
atf_add_test_case two_char_regex_star_rs
atf_add_test_case single_char_regex_star_rs
atf_add_test_case regex_two_star_rs
atf_add_test_case regex_or_1_rs
atf_add_test_case regex_or_2_rs
atf_add_test_case regex_or_3_rs
atf_add_test_case regex_caret_1_rs
atf_add_test_case regex_caret_2_rs
atf_add_test_case regex_dollar_1_rs
atf_add_test_case regex_dollar_2_rs
atf_add_test_case regex_reallocation_rs
atf_add_test_case empty_rs
atf_add_test_case newline_rs
atf_add_test_case modify_subsep
}