1# -*- Autotest -*- 2 3AT_BANNER([Autotest.]) 4 5# Copyright (C) 2004-2012 Free Software Foundation, Inc. 6# 7# This program is free software: you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation, either version 3 of the License, or 10# (at your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with this program. If not, see <http://www.gnu.org/licenses/>. 19 20 21# AT_DATA_AUTOTEST(FILE-NAME, CONTENTS) 22# ------------------------------------- 23# Escape the invalid tokens with @&t@. 24m4_define([AT_DATA_AUTOTEST], 25[AT_DATA([$1], 26[m4_bpatsubst([$2], [\(@.\)\(.@\)\|\(m4\|AS\|AT\)\(_\)\|\(d\)\(nl\)], 27 [\1\3\5@&t@\2\4\6])])]) 28 29 30# AT_CHECK_AT_PREP(NAME, SUITE-CODE, [STATUS = 0], [STDOUT], [STDERR], 31# [DIR = .]) 32# -------------------------------------------------------------------- 33# Create a new testsuite named NAME that runs a minimal Autotest test suite, 34# SUITE-CODE. Do not use `testsuite' for NAME, or the log file it generates 35# will overwrite the log that the Autoconf test produces when managing 36# this test case. STATUS, STDOUT, and STDERR pass directly to the AT_CHECK 37# that compiles the testsuite. DIR can specify a particular subdirectory 38# where the testsuite should live. 39m4_define([AT_CHECK_AT_PREP], 40[AT_KEYWORDS([autotest])dnl 41dnl overquote AT_dir, to make it easier to use 42m4_pushdef([AT_dir], m4_ifval([$6], [[[$6]]], [.]))dnl 43dnl 44AT_CAPTURE_FILE(AT_dir[/$1.log])dnl 45dnl 46AT_DATA_AUTOTEST(AT_dir[/package.m4], 47[[m4_define([AT_PACKAGE_NAME], [GNU Nonsense]) 48m4_define([AT_PACKAGE_TARNAME], [nonsense]) 49m4_define([AT_PACKAGE_VERSION], [1.0]) 50m4_define([AT_PACKAGE_STRING], [GNU Nonsense 1.0]) 51m4_define([AT_PACKAGE_BUGREPORT], [bug-autoconf@gnu.org]) 52]]) 53dnl 54AT_DATA_AUTOTEST(AT_dir[/$1.at], [$2]) 55AT_CHECK([cat >m4_default([$6], [.])/atconfig <<EOF 56at_testdir=m4_default([$6], [.]) 57abs_builddir='`pwd`' 58at_srcdir=. 59abs_srcdir='`pwd`' 60at_top_srcdir=. 61abs_top_srcdir='`pwd`' 62at_top_build_prefix= 63abs_top_builddir='`pwd`' 64EOF]) 65m4_ifval([$6], [(cd AT_dir]) 66AT_CHECK_AUTOM4TE([--language=autotest -o $1 $1.at], [$3], [$4], [$5]) 67m4_ifval([$6], [)]) 68m4_popdef([AT_dir])dnl 69]) # AT_CHECK_AT_PREP 70 71# AT_CHECK_AT(TITLE, SUITE-CODE, [XFAIL-CONDITION], [STATUS = 0], 72# [STDOUT = ignore], STDERR, [PRE-TEST-CODE], 73# [POST-TEST-CODE], [SUITE-ARGS]) 74# --------------------------------------------------------------- 75# Create a new test named TITLE that runs a minimal Autotest test suite, 76# SUITE-CODE with additional SUITE-ARGS, once without and once with 77# '-v -x' added. Call AT_XFAIL_IF with XFAIL-CONDITION. Pass STDERR 78# directly to the AT_CHECK that calls the minimal test suite, STDOUT to 79# the AT_CHECK without '-v -x'; ignore stdout for the latter. 80# Run PRE-TEST-CODE at the top level after the micro-suite is created, but 81# before it is run, and POST-TEST-CODE after the micro-suite has been run. 82m4_define([AT_CHECK_AT], 83[AT_SETUP([$1]) 84AT_XFAIL_IF([$3]) 85AT_CHECK_AT_PREP([micro-suite], [$2]) 86$7 87AT_CHECK([$CONFIG_SHELL ./micro-suite $9], m4_default([$4], 0), 88 m4_default([$5], [ignore]), [$6]) 89AT_CHECK([$CONFIG_SHELL ./micro-suite -v -x $9], m4_default([$4], 0), 90 [ignore], [$6]) 91$8 92AT_CLEANUP 93])# AT_CHECK_AT 94 95# AT_CHECK_AT_TEST(TITLE, SUITE-SNIPPET, ...) 96# ------------------------------------------- 97# Wrapper for AT_CHECK_AT that surrounds SUITE-SNIPPET with a boilerplate 98# AT_INIT, AT_SETUP, and AT_CLEANUP and passes other arguments verbatim. 99m4_define([AT_CHECK_AT_TEST], 100[AT_CHECK_AT([$1], 101[[ 102AT_INIT([artificial test suite]) 103AT_SETUP([my only test]) 104$2 105AT_CLEANUP 106]], m4_shift2($@))]) # AT_CHECK_AT_TEST 107 108# AT_CHECK_AT_SYNTAX(TITLE, SUITE, MESSAGE) 109# ----------------------------------------- 110# Create a test named TITLE that tries compiling SUITE with syntax 111# errors with autotest. Expect a failed compilation, and grep for 112# MESSAGE occurring within the error output. 113m4_define([AT_CHECK_AT_SYNTAX], 114[AT_SETUP([$1]) 115AT_CHECK_AT_PREP([micro-suite], [$2], [1], [], [stderr]) 116AT_CHECK([grep '$3' stderr], [0], [ignore]) 117AT_CLEANUP 118])# AT_CHECK_AT_SYNTAX 119 120 121# AT_NO_CMDSUBST 122# -------------- 123m4_define([AT_NO_CMDSUBST], 124[if (eval 'foo=$(echo bar) && test "$foo" = bar') >/dev/null 2>&1; then ]dnl 125[false; else :; fi]) 126 127# AT_CHECK_EGREP(PATTERN, STATUS, COUNT) 128# -------------------------------------- 129# Run grep -E, counting how many times PATTERN occurs in the file 'stdout', 130# and expecting exit STATUS and output COUNT. 131m4_define([AT_CHECK_EGREP], 132[AT_CHECK([$EGREP -c '$1' stdout], [$2], [$3 133], [ignore]) 134]) 135 136 137## -------------- ## 138## AT_COPYRIGHT. ## 139## -------------- ## 140 141# Ensure the FSF notice as well as the user-provided one are present 142# in the head of the testsuite as well as the --version output. 143 144AT_CHECK_AT([AT@&t@_COPYRIGHT], 145[[AT_INIT([Testing AT@&t@_COPYRIGHT]) 146AT_COPYRIGHT([[This is just a test notice, not a real one, so let's avoid 147words that may be matched by scanners for legal things, 148causing extra work for distributors. 149Multi-line values should be supported. 150]]) 151]], [], [], [stdout], [], [], [ 152AT_CHECK([grep 'Copyright.*Free Software Foundation' stdout], [], [ignore]) 153AT_CHECK([grep 'This is just a test notice' stdout], [], [ignore]) 154AT_CHECK([sed 50q micro-suite | grep 'Copyright.*Free Software Foundation'], 155 [], [ignore]) 156AT_CHECK([sed 50q micro-suite | grep 'This is just a test notice'], 157 [], [ignore])], 158[--version]) 159 160 161## --------- ## 162## AT_DATA. ## 163## --------- ## 164 165AT_CHECK_AT_TEST([AT@&t@_DATA], [ 166AT_CHECK([test -f file1], [1]) 167AT_DATA([file1]) 168AT_CHECK([test -f file1 && test ! -s file1]) 169AT_CHECK([echo hi > file1]) 170AT_DATA([file1], [[]]) 171AT_CHECK([test -f file1 && test ! -s file1]) 172file=file2 173AT_DATA([$file], [[$file 174]]) 175AT_CHECK([echo '$file' > file3]) 176AT_CHECK([cmp file2 file3]) 177]) 178 179 180## ------------------ ## 181## Empty test suite. ## 182## ------------------ ## 183 184# This is not a sensible thing to do, but the user should not get an unhelpful 185# error message. 186AT_CHECK_AT([Empty test suite], 187[[AT_INIT([empty test suite]) 188]]) 189 190AT_CHECK_AT([Banner-only test suite], 191[[AT_INIT([empty test suite]) 192AT_BANNER([banner]) 193]]) 194 195# Next level of emptiness. 196AT_CHECK_AT_TEST([Empty test], []) 197 198# And finally, an empty check should not cause a syntax error. 199AT_CHECK_AT_TEST([Empty check], [AT_CHECK]) 200 201# Check for sensible error messages for common bugs. 202AT_CHECK_AT_SYNTAX([AT@&t@_SETUP without AT@&t@_INIT], 203[[AT_SETUP([only test]) 204AT_CHECK([:]) 205AT_CLEANUP 206]], [AT@&t@_SETUP: missing AT@&t@_INIT detected]) 207 208AT_CHECK_AT_SYNTAX([AT@&t@_BANNER without AT@&t@_INIT], 209[[AT_BANNER([just a banner]) 210]], [AT@&t@_BANNER: missing AT@&t@_INIT detected]) 211 212AT_CHECK_AT_SYNTAX([AT@&t@_CLEANUP without AT@&t@_INIT], 213[[AT_CLEANUP 214]], [AT@&t@_CLEANUP: missing AT@&t@_INIT detected]) 215 216AT_CHECK_AT_SYNTAX([Missing AT@&t@_CLEANUP], 217[[AT_INIT([incomplete test suite]) 218AT_SETUP([only test]) 219AT_CHECK([:]) 220]], [missing AT@&t@_CLEANUP detected]) 221 222AT_CHECK_AT_SYNTAX([AT@&t@_FAIL_IF without AT@&t@_SETUP], 223[[AT_INIT([incomplete test suite]) 224AT_FAIL_IF([:]) 225]], [AT@&t@_FAIL_IF: missing AT@&t@_SETUP detected]) 226 227AT_CHECK_AT_SYNTAX([AT@&t@_SKIP_IF without AT@&t@_SETUP], 228[[AT_INIT([incomplete test suite]) 229AT_SKIP_IF([:]) 230]], [AT@&t@_SKIP_IF: missing AT@&t@_SETUP detected]) 231 232AT_CHECK_AT_SYNTAX([AT@&t@_CHECK without AT@&t@_SETUP], 233[[AT_INIT([incomplete test suite]) 234AT_CHECK([:]) 235]], [AT@&t@_CHECK: missing AT@&t@_SETUP detected]) 236 237AT_CHECK_AT_SYNTAX([AT@&t@_DATA without AT@&t@_SETUP], 238[[AT_INIT([incomplete test suite]) 239AT_DATA([file]) 240]], [AT@&t@_DATA: missing AT@&t@_SETUP detected]) 241 242AT_CHECK_AT_SYNTAX([AT@&t@_XFAIL_IF without AT@&t@_SETUP], 243[[AT_INIT([incomplete test suite]) 244AT_XFAIL_IF([:]) 245]], [AT@&t@_XFAIL_IF: missing AT@&t@_SETUP detected]) 246 247AT_CHECK_AT_SYNTAX([AT@&t@_KEYWORDS without AT@&t@_SETUP], 248[[AT_INIT([incomplete test suite]) 249AT_KEYWORDS([keyword]) 250]], [AT@&t@_KEYWORDS: missing AT@&t@_SETUP detected]) 251 252AT_CHECK_AT_SYNTAX([AT@&t@_CLEANUP without AT@&t@_SETUP], 253[[AT_INIT([incomplete test suite]) 254AT_CLEANUP 255]], [AT@&t@_CLEANUP: missing AT@&t@_SETUP detected]) 256 257AT_CHECK_AT_SYNTAX([AT@&t@_BANNER inside AT@&t@_SETUP], 258[[AT_INIT([incomplete test suite]) 259AT_SETUP([only test]) 260AT_BANNER([banner]) 261AT_CHECK([:]) 262AT_CLEANUP 263]], [AT@&t@_BANNER: nested AT@&t@_SETUP detected]) 264 265AT_CHECK_AT_SYNTAX([AT@&t@_SETUP inside AT@&t@_SETUP], 266[[AT_INIT([incomplete test suite]) 267AT_SETUP([only test]) 268 AT_SETUP([nested test]) 269 AT_CHECK([:]) 270 AT_CLEANUP 271AT_CHECK([:]) 272AT_CLEANUP 273]], [AT@&t@_SETUP: nested AT@&t@_SETUP detected]) 274 275AT_CHECK_AT_SYNTAX([Multiple AT@&t@_INIT], 276[[AT_INIT([[suite, take one]]) 277AT_INIT([repeat]) 278]], [AT@&t@_INIT: invoked multiple times]) 279 280# Check for tested programs. autoconf should only appear once. 281AT_CHECK_AT([Tested programs], 282[[AT_INIT([programs test suite]) 283AT_TESTED([autoconf autom4te]) 284AT_TESTED([autoconf]) 285]], [], [], [], [], [], 286[AT_CHECK([[sed -n 's|.*/\([^ /]* --version\)|\1|p' micro-suite.log]], [], 287[[autoconf --version 288autom4te --version 289]])]) 290 291AT_CHECK_AT([Startup error messages], 292[[AT_INIT([[suite]]) 293AT_SETUP([only test]) 294AT_CHECK([:]) 295AT_CLEANUP 296]], [], [], [], [], [], 297[AT_CHECK([sed -n '/exec AS_MESSAGE_LOG_FD/q; />&AS_MESSAGE_LOG_FD/p' < micro-suite])]) 298 299## ----------------- ## 300## Status handling. ## 301## ----------------- ## 302 303AT_CHECK_AT_TEST([Truth], 304 [AT_CHECK([:], 0, [], [])]) 305 306AT_CHECK_AT_TEST([Fallacy], 307 [AT_CHECK([false], [], [], [])], 308 [], [1], [], [ignore], [], 309 [AT_CHECK([grep failed micro-suite.log], [], [ignore])]) 310 311AT_CHECK_AT_TEST([Skip], 312 [AT_CHECK([echo output; echo irrelevant >&2; exit 77], 0, [mismatch], [])], 313 [], [], [], [], [], 314 [AT_CHECK([grep skipped micro-suite.log], [], [ignore])]) 315 316AT_CHECK_AT_TEST([Hard fail], 317 [AT_CHECK([exit 99]) 318 AT_CLEANUP 319 AT_SETUP([another test]) 320 AT_XFAIL_IF([:]) 321 AT_CHECK([exit 99])], 322 [], [1], [], [ignore], [], 323 [AT_CHECK([grep '2 failed unexpectedly' micro-suite.log], [], [ignore]) 324 AT_CHECK([grep '^[[12]].*ok' micro-suite.log], [1])]) 325 326AT_CHECK_AT_TEST([AT@&t@_FAIL_IF], 327 [AT_FAIL_IF([:]) 328 AT_CLEANUP 329 AT_SETUP 330 AT_FAIL_IF([false]) 331 AT_CLEANUP 332 AT_SETUP 333 AT_FAIL_IF([test x = y]) 334 AT_CLEANUP 335 AT_SETUP 336 AT_FAIL_IF([bah]) 337 AT_CLEANUP 338 AT_SETUP 339 AT_FAIL_IF([test x = x]) 340 AT_CLEANUP 341 AT_SETUP 342 AT_FAIL_IF([test $foo = x])], 343 [], [1], [stdout], [ignore], [], 344 [AT_CHECK([grep '1 5 failed' stdout], [], [ignore], [ignore])]) 345 346AT_CHECK_AT_TEST([AT@&t@_SKIP_IF], 347 [AT_SKIP_IF([:]) 348 AT_CLEANUP 349 AT_SETUP 350 AT_SKIP_IF([false]) 351 AT_CLEANUP 352 AT_SETUP 353 AT_SKIP_IF([test x = y]) 354 AT_CLEANUP 355 AT_SETUP 356 AT_SKIP_IF([bah]) 357 AT_CLEANUP 358 AT_SETUP 359 AT_SKIP_IF([test x = x]) 360 AT_CLEANUP 361 AT_SETUP 362 AT_SKIP_IF([test $foo = x])], 363 [], [], [], [], [], 364 [AT_CHECK([grep '2.*skipped' micro-suite.log], [], [ignore], [ignore])]) 365 366AT_CHECK_AT_TEST([Syntax error], 367 [AT_CHECK([:]) 368 AT_CLEANUP 369 AT_SETUP([syntax]) 370 AT_CHECK([if]) 371 AT_CLEANUP 372 AT_SETUP([another test]) 373 AT_CHECK([:])], 374 [], [0], [], [], [], 375 [dnl Until we can find a way to avoid catastrophic failure (ash) or 376 dnl lack of failure (zsh), skip the rest of this test on such shells. 377 echo 'if' > syntax 378 AT_CHECK([${CONFIG_SHELL-$SHELL} -c 'case `. ./syntax; echo $?` in 379 0|"") exit 77;; 380 esac'], [0], [ignore], [ignore]) 381 AT_CHECK([$CONFIG_SHELL ./micro-suite], [1], [ignore], [stderr]) 382 AT_CHECK([grep "unable to parse test group: 2" stderr], [0], [ignore])], 383 [1 3]) 384 385AT_CHECK_AT_TEST([errexit], 386 [AT_CHECK([false]) 387 AT_CLEANUP 388 AT_SETUP([test that should not be run]) 389 AT_CHECK([:]) 390 AT_CLEANUP 391 AT_SETUP([xpassing test]) 392 AT_XFAIL_IF([:]) 393 AT_CHECK([:]) 394 AT_CLEANUP 395 AT_SETUP([another test that should not be run]) 396 AT_CHECK([:]) 397 AT_CLEANUP 398 AT_SETUP([skipping test]) 399 AT_CHECK([exit 77]) 400 AT_CLEANUP 401 AT_SETUP([xfailing test]) 402 AT_XFAIL_IF([:]) 403 AT_CHECK([false]) 404 AT_CLEANUP 405 AT_SETUP([a test that should be run]) 406 AT_CLEANUP 407 AT_SETUP([hard failure]) 408 AT_XFAIL_IF([:]) 409 AT_CHECK([exit 99]) 410 AT_CLEANUP 411 AT_SETUP([yet another test that should not be run])], 412 [], [1], [stdout], [stderr], [], 413 [AT_CHECK([test -f micro-suite.log], [1]) 414 touch micro-suite.log # shut up AT_CAPTURE_FILE. 415 AT_CHECK([grep "should not be run" stdout], [1]) 416 AT_CHECK([grep "1 .* inhibited subsequent" stderr], [], [ignore]) 417 AT_CHECK([$CONFIG_SHELL ./micro-suite --errexit 3-], [1], [stdout], [stderr]) 418 AT_CHECK([grep "should not be run" stdout], [1]) 419 AT_CHECK([grep "1 .* inhibited subsequent" stderr], [], [ignore]) 420 AT_CHECK([$CONFIG_SHELL ./micro-suite --errexit 5-], [1], [stdout], [stderr]) 421 AT_CHECK([grep "should be run" stdout], [0], [ignore]) 422 AT_CHECK([grep "should not be run" stdout], [1]) 423 AT_CHECK([grep "inhibited subsequent" stderr], [], [ignore])], 424 [--errexit]) 425 426 427AT_CHECK_AT_TEST([at_status], 428 [AT_CHECK([exit $mystatus], [$expected], [], [], 429 [AT_CHECK([echo run-if-fail: $at_status], [], [ignore])], 430 [AT_CHECK([echo run-if-pass: $at_status], [], [ignore])]) 431 AT_CLEANUP 432 AT_SETUP([test with nested checks]) 433 AT_CHECK([exit $mystatus], [$expected], [], [], 434 [AT_CHECK([exit $mystatus], [$expected], [], [], 435 [AT_CHECK([echo inner run-if-fail: $at_status], [], 436 [ignore])])])], 437 [], [], [stdout], [], 438[], [ 439AT_CHECK([grep 'inner run-if-fail: 42' stdout], [], [ignore]) 440AT_CHECK([$CONFIG_SHELL ./micro-suite -x -v 1 mystatus=0 expected=0], [], [stdout]) 441AT_CHECK([grep 'run-if-pass: 0' stdout], [], [ignore]) 442AT_CHECK([$CONFIG_SHELL ./micro-suite -x -v 1 mystatus=42 expected=0], [], [stdout]) 443AT_CHECK([grep 'run-if-fail: 42' stdout], [], [ignore]) 444AT_CHECK([$CONFIG_SHELL ./micro-suite -x -v 1 mystatus=0 expected=42], [], [stdout]) 445AT_CHECK([grep 'run-if-fail: 0' stdout], [], [ignore]) 446AT_CHECK([$CONFIG_SHELL ./micro-suite -x -v 1 mystatus=42 expected=42], [], [stdout]) 447AT_CHECK([grep 'run-if-pass: 42' stdout], [], [ignore]) 448], 449[-v mystatus=42 expected=1 450]) 451 452 453AT_CHECK_AT_TEST([AT@&t@_CHECK execution environment], 454 [dnl The first test should fail, so we enter RUN-IF-FAIL. 455 AT_CHECK([test "$state" != before], [], [], [], 456 [state=run-if-fail 457 AT_CHECK([:]) dnl need this so we do not bail out at this point. 458 ]) 459 dnl This should pass, so we enter RUN-IF-PASS. 460 AT_CHECK([test "$state" = run-if-fail], [], [], [], [], 461 [state=run-if-pass]) 462 AT_CHECK([test "$state" = run-if-pass]) 463 dnl However, COMMANDS are run inside a subshell, so do not change state. 464 AT_CHECK([state=broken; false], [], [], [], 465 [AT_CHECK([test "$state" = run-if-pass])]) 466 AT_CHECK([state=broken], [], [], [], [], 467 [AT_CHECK([test "$state" = run-if-pass])]) 468 ], 469 [], [], [], [], [], [], [state=before]) 470 471 472AT_CHECK_AT_TEST([unquoted output], 473 [m4_define([backtick], [`]) 474 a=a 475 AT_CHECK_UNQUOTED([echo 'a"b backtick`'], [], 476 [${a}"`echo 'b '`\`\backtick]m4_newline)], 477 [], [], [], [], [AT_KEYWORDS([AT@&t@_CHECK_UNQUOTED])]) 478 479AT_CHECK_AT_TEST([Trace output], 480 [AT_CHECK([echo some longer longer longer command piped | ]dnl 481 [sed 's,into some other longer longer longer command,,'], 482 [], [some longer longer longer command piped 483])]) 484 485AT_CHECK_AT([Logging], 486 [[AT_INIT([artificial test suite]) 487 dnl intentionally write failing tests, to see what gets logged 488 AT_SETUP([one]) 489 AT_CHECK([echo magicstring01], [1], [ignore]) 490 AT_CLEANUP 491 AT_SETUP([two]) 492 AT_CHECK([echo magicstring02 >&2], [1], [], [ignore]) 493 AT_CLEANUP 494 AT_SETUP([three]) 495 AT_CHECK([echo magicstring03], [1], [ignore-nolog]) 496 AT_CLEANUP 497 AT_SETUP([four]) 498 AT_CHECK([echo magicstring04 >&2], [1], [], [ignore-nolog]) 499 AT_CLEANUP 500 AT_SETUP([five]) 501 AT_CHECK([echo magicstring05], [1], [stdout]) 502 AT_CLEANUP 503 AT_SETUP([six]) 504 AT_CHECK([echo magicstring06 >&2], [1], [], [stderr]) 505 AT_CLEANUP 506 AT_SETUP([seven]) 507 AT_CHECK([echo magicstring07], [1], [stdout-nolog]) 508 AT_CLEANUP 509 AT_SETUP([eight]) 510 AT_CHECK([echo magicstring08 >&2], [1], [], [stderr-nolog]) 511 AT_CLEANUP 512 AT_SETUP([nine]) 513 echo magicstring09 > expout 514 AT_CHECK([echo magicstring09], [1], [expout]) 515 AT_CLEANUP 516 AT_SETUP([ten]) 517 echo magicstring10 > experr 518 AT_CHECK([echo magicstring10 >&2], [1], [], [experr]) 519 AT_CLEANUP 520]], [], [1], [], [ignore], [], 521 [AT_CHECK([$CONFIG_SHELL ./micro-suite], [1], [ignore-nolog], [ignore-nolog]) 522 AT_CHECK([grep '^magicstring' micro-suite.log], [], 523[[magicstring01 524magicstring02 525magicstring05 526magicstring06 527]])]) 528 529 530AT_CHECK_AT([Binary output], 531 [[AT_INIT([artificial test suite]) 532 AT_SETUP([pass: no trailing newline]) 533 AT_CHECK([printf short], [0], [stdout-nolog]) 534 AT_CHECK([cat stdout], [0], [[short]]) 535 AT_CLEANUP 536 AT_SETUP([pass: non-printing characters]) 537 AT_CHECK([printf '\1\n' >&2], [0], [], [stderr-nolog]) 538 printf '\1\n' > expout 539 AT_CHECK([cat stderr], [0], [expout]) 540 AT_CLEANUP 541 AT_SETUP([pass: long lines]) 542 # 5000 bytes in str 543 str=.......... 544 str=$str$str$str$str$str$str$str$str$str$str 545 str=$str$str$str$str$str$str$str$str$str$str 546 str=$str$str$str$str$str 547 AT_CHECK_UNQUOTED([echo $str], [0], [[$str]m4_newline]) 548 AT_CLEANUP 549 AT_SETUP([fail: no trailing newline]) 550 AT_CHECK([printf short], [0], [stdout-nolog]) 551 AT_CHECK([cat stdout], [0], [[long]]) 552 AT_CLEANUP 553 AT_SETUP([fail: non-printing characters]) 554 AT_CHECK([printf '\1\n' >&2], [0], [], [stderr-nolog]) 555 printf '\2\n' > expout 556 AT_CHECK([cat stderr], [0], [expout]) 557 AT_CLEANUP 558 AT_SETUP([fail: long lines]) 559 # 5000 bytes in str 560 str=.......... 561 str=$str$str$str$str$str$str$str$str$str$str 562 str=$str$str$str$str$str$str$str$str$str$str 563 str=$str$str$str$str$str 564 AT_CHECK_UNQUOTED([echo x$str], [0], [[${str}x]m4_newline]) 565 AT_CLEANUP 566]], [], [0], [], [], [], 567 [AT_CHECK([$CONFIG_SHELL ./micro-suite 4], [1], [ignore], [ignore]) 568 AT_CHECK([$CONFIG_SHELL ./micro-suite 5], [1], [ignore], [ignore]) 569 AT_CHECK([$CONFIG_SHELL ./micro-suite 6], [1], [ignore], [ignore])], [1-3]) 570 571 572AT_CHECK_AT_TEST([Cleanup], 573 [AT_CHECK([test ! -f cleanup.success && test ! -f cleanup.failure]) 574 AT_XFAIL_IF([$xfail]) 575 AT_CHECK_UNQUOTED([exit $value], [ignore], [$output], 576 [], [touch cleanup.failure], [touch cleanup.success])], 577 [], [], [], [], 578 [AT_KEYWORDS([AT@&t@_CHECK_UNQUOTED]) 579 output=; export output], 580 [AT_CHECK([test -d micro-suite.dir/1]) 581 AT_CHECK([test -f micro-suite.dir/1/cleanup.success]) 582 AT_CHECK([test ! -f micro-suite.dir/1/cleanup.failure]) 583 584 AT_CHECK([$CONFIG_SHELL ./micro-suite -d xfail=false value=1], [], [ignore]) 585 AT_CHECK([test -f micro-suite.dir/1/cleanup.success]) 586 AT_CHECK([test ! -f micro-suite.dir/1/cleanup.failure]) 587 588 AT_CHECK([$CONFIG_SHELL ./micro-suite xfail=: value=0], 589 [1], [ignore], [ignore]) 590 AT_CHECK([test -f micro-suite.dir/1/cleanup.success]) 591 AT_CHECK([test ! -f micro-suite.dir/1/cleanup.failure]) 592 593 AT_CHECK([$CONFIG_SHELL ./micro-suite -d xfail=false value=1 output=mismatch], 594 [1], [ignore], [ignore]) 595 AT_CHECK([test ! -f micro-suite.dir/1/cleanup.success]) 596 AT_CHECK([test -f micro-suite.dir/1/cleanup.failure]) 597 598 AT_CHECK([$CONFIG_SHELL ./micro-suite -d xfail=false value=77], [], [ignore]) 599 AT_CHECK([test ! -f micro-suite.dir/1/cleanup.success]) 600 AT_CHECK([test ! -f micro-suite.dir/1/cleanup.failure]) 601 602 AT_CHECK([$CONFIG_SHELL ./micro-suite -d xfail=false value=99], 603 [1], [ignore], [ignore]) 604 AT_CHECK([test ! -f micro-suite.dir/1/cleanup.success]) 605 AT_CHECK([test ! -f micro-suite.dir/1/cleanup.failure]) 606 ], [-d xfail=false value=0]) 607 608## ----------------------------------------------------- ## 609## Newlines and command substitutions in test commands. ## 610## ----------------------------------------------------- ## 611 612AT_CHECK_AT_TEST([Literal multiline command], 613 [AT_CHECK([echo Auto' 614'conf], 0, [Auto 615conf 616], [])]) 617 618AT_CHECK_AT_TEST([Multiline parameter expansion], 619 [FOO='one 620two' 621 AT_CHECK([echo "$FOO"], 0, [one 622two 623], [])]) 624 625AT_CHECK_AT_TEST([Backquote command substitution], 626 [AT_CHECK([echo `echo hi`], 0, [hi 627], [])]) 628 629 630AT_CHECK_AT_TEST([Multiline backquote command substitution], 631 [AT_DATA([myfile],[foo 632bar 633]) 634 AT_CHECK([echo "`cat myfile`"], 0, [foo 635bar 636], [])]) 637 638AT_CHECK_AT_TEST([Parenthetical command substitution], 639 [AT_CHECK([echo $(echo hi)], 0, [hi 640], [])], 641 [AT_NO_CMDSUBST]) 642 643AT_CHECK_AT_TEST([Multiline parenthetical command substitution], 644 [AT_DATA([myfile],[foo 645bar 646]) 647 AT_CHECK([echo "$(cat myfile)"], 0, [foo 648bar 649], [])], 650 [AT_NO_CMDSUBST]) 651 652 653AT_CHECK_AT_TEST([Shell comment in command], 654 [my_echo=echo 655 AT_CHECK([$my_echo one [#] two], [], [one 656])]) 657 658 659## ------------------------- ## 660## ${...} in test commands. ## 661## ------------------------- ## 662 663# If this invalid parameter expansion capsizes the test suite, the entire 664# AT_SETUP ... AT_CLEANUP subshell will exit, and the commands it runs will 665# appear to have succeeded. Therefore, we verify a failing test case. 666 667AT_CHECK_AT_TEST([Invalid brace-enclosed parameter expansion], 668 [AT_CHECK([echo '${=invalid}'], 0, [wrong])], [false], 1, ignore, ignore) 669 670 671## ---------------------------- ## 672## M4 macros in test commands. ## 673## ---------------------------- ## 674 675AT_CHECK_AT_TEST([Multiline command from M4 expansion], 676 [m4_define([GNU], ['foo 677bar']) 678 AT_CHECK([echo GNU], 0, [foo 679bar 680], [])]) 681 682AT_CHECK_AT_TEST([Double-M4-quoted command], 683 [m4_define([GNU], ['foo 684bar']) 685 AT_CHECK([[echo GNU]], 0, [[GNU 686]], [])]) 687 688 689AT_CHECK_AT_TEST([Metacharacters in command from M4 expansion], 690 [m4_define([GNU], [\"`]) 691 AT_CHECK([echo '\"`' [GNU] 'GNU'], 0, [GNU [G][NU] [\"` 692]], [])]) 693 694 695## -------------------------------------- ## 696## Backslash-<newline> in test commands. ## 697## -------------------------------------- ## 698 699AT_CHECK_AT_TEST([BS-newline in command], 700 [AT_CHECK([echo Auto"\ 701"conf], 0, [Autoconf 702], [])]) 703 704AT_CHECK_AT_TEST([^BS-newline in command], 705 [AT_CHECK([\ 706echo GNU], 0, [GNU 707], [])]) 708 709AT_CHECK_AT_TEST([BSx641-newline in command], 710 [AT_CHECK([printf '%s\n' Auto"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 711"conf], 0, [Auto\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\conf 712], [])]) 713 714AT_CHECK_AT_TEST([BS-BS-newline in command], 715 [AT_CHECK([printf '%s\n' Auto"\\ 716"conf], 0, [Auto\ 717conf 718], [])]) 719 720# A `^BS-BS-newline in command' test will run a command named `\'. No, thanks. 721 722AT_CHECK_AT_TEST([BSx640-newline in command], 723 [AT_CHECK([printf '%s\n' Auto"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 724"conf], 0, [Auto\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 725conf 726], [])]) 727 728# This command has both escaped and unescaped newlines. 729AT_CHECK_AT_TEST([Newline-CODE-BS-newline in command], 730 [AT_CHECK([printf '%s\n' Auto' 731'co\ 732nf], 0, [Auto 733conf 734], [])]) 735 736AT_CHECK_AT_TEST([Single-quote-BS-newline in command], 737 [AT_CHECK([printf '%s\n' Auto'\ 738'conf], 0, [Auto\ 739conf 740], [])]) 741 742AT_CHECK_AT_TEST([Single-quote-newline-BS-newline in command], 743 [AT_CHECK([printf '%s\n' Auto' 744\ 745'conf], 0, [Auto 746\ 747conf 748], [])]) 749 750 751## ----------------- ## 752## Input from stdin. ## 753## ----------------- ## 754 755AT_SETUP([Input from stdin]) 756 757AT_CHECK_AT_PREP([micro-suite], 758[[AT_INIT 759AT_SETUP([please enter hello<RETURN><EOF>]) 760AT_CHECK([cat], [], [hello 761]) 762AT_CLEANUP 763]]) 764 765AT_CHECK([echo hello | $CONFIG_SHELL ./micro-suite], [], [ignore]) 766AT_CHECK([$CONFIG_SHELL ./micro-suite </dev/null], [1], [ignore], [ignore]) 767 768AT_CLEANUP 769 770 771## ------------------------------- ## 772## Funny characters in test names. ## 773## ------------------------------- ## 774 775# AT_CHECK_AT_TITLE(TITLE, TITLE-TO-TEST, EXPANDED-TITLE-TO-TEST, 776# [XFAIL-CONDITION], [COLUMN = 53]) 777# --------------------------------------------------------------- 778# Create a new test named TITLE that runs an Autotest test suite 779# comprised of a trivial test named TITLE-TO-TEST, which expands 780# to EXPANDED-TITLE-TO-TEST. XFAIL-CONDITION passes verbatim to 781# AT_CHECK_AT. Verify that `ok' prints at COLUMN. 782m4_define([AT_CHECK_AT_TITLE], 783[AT_CHECK_AT([$1], 784[[ 785m4_define([macro_name], [[macro_expanded]]) 786m4_define([macro_expanded], [[macro_overexpanded]]) 787m4_define([macro_backquote], [`]) 788m4_define([macro_single_quote], [']) 789m4_define([macro_double_quote], ["]) 790]]dnl restore font-lock: " 791[[m4_define([macro_backslash], [\]) 792m4_define([macro_echo], [$][1]) 793AT_INIT([artificial test suite]) 794AT_SETUP([$2]) 795AT_CHECK([:]) 796AT_CLEANUP 797]], [$4], [], [], [], [], 798dnl This sed script checks for two things - that the output is properly 799dnl expanded, and that the 'ok' starts on the right column. 800[AT_KEYWORDS([m4@&t@_expand]) 801AT_CHECK([[$CONFIG_SHELL ./micro-suite | 802 sed -n '/^ 1:/{ 803h 804s/[^:]*: \(.*[^ ]\)[ ]*ok.*/\1/p 805x 806s/^.\{]]]m4_default($5, 53)[[[\}ok.*/ok/p 807}']],, 808[[$3 809ok 810]]) 811dnl This sed script checks for two things - that -v output doesn't have 812dnl an empty $at_srcdir expansion, and that the 'testing ...' line 813dnl contains the test group title. 814AT_CHECK([[$CONFIG_SHELL ./micro-suite -v | 815 sed -n 's/.*testing \(.*\) \.\.\./\1/p; /^\/micro-suite\.at:/p']],, 816[[$3 817]]) 818AT_CHECK([[$CONFIG_SHELL ./micro-suite -l | 819 sed -n 's/.*[0-9]: [^ ][^ ]*[ ][ ]*\(.*[^ ]\)[ ]*/\1/p']],, 820[[$3 821]]) 822AT_CHECK([[sed -n 's/[^.]*\. \(.*\) ([^)]*): ok.*/\1/p' micro-suite.log]],, 823[[$3 824]]) 825])]) 826 827m4_define([AT_CHECK_AT_TITLE_CHAR], 828[AT_CHECK_AT_TITLE([$1 in a test title], [A $2 in my name], 829 [A ]m4_ifval([$3], [[$3]], [[$2]])[ in my name], $4, $5)]) 830 831AT_CHECK_AT_TITLE_CHAR([Backquote], [`]) 832AT_CHECK_AT_TITLE_CHAR([Single-quote], [']) 833AT_CHECK_AT_TITLE_CHAR([Double-quote], ["]) 834dnl restore font-lock: " 835AT_CHECK_AT_TITLE_CHAR([Backslash], [\]) 836AT_CHECK_AT_TITLE_CHAR([Brackets], [[[]]], [[]]) 837AT_CHECK_AT_TITLE_CHAR([Left bracket], [@<:@], [@<:@]) 838AT_CHECK_AT_TITLE_CHAR([Right bracket], [@:>@], [@:>@]) 839AT_CHECK_AT_TITLE_CHAR([Quoted pound], [[#]], [#]) 840AT_CHECK_AT_TITLE_CHAR([Pound], [#]) 841AT_CHECK_AT_TITLE_CHAR([Quoted comma], [[,]], [,]) 842AT_CHECK_AT_TITLE_CHAR([Comma], [,]) 843dnl this test also hits quadrigraphs for () 844AT_CHECK_AT_TITLE_CHAR([Parentheses], [(@{:@)@:}@], [(())]) 845AT_CHECK_AT_TITLE_CHAR([Left paren], [[(]], [(]) 846AT_CHECK_AT_TITLE_CHAR([Right paren], [[)]], [)]) 847 848AT_CHECK_AT_TITLE_CHAR([Quoted Macro], [[macro_name]], [macro_name]) 849AT_CHECK_AT_TITLE_CHAR([Macro], [macro_name], [macro_expanded]) 850AT_CHECK_AT_TITLE_CHAR([Macro with backquote], [macro_backquote], [`]) 851AT_CHECK_AT_TITLE_CHAR([Macro with single-quote], [macro_single_quote], [']) 852AT_CHECK_AT_TITLE_CHAR([Macro with double-quote], [macro_double_quote], ["]) 853dnl restore font-lock: " 854AT_CHECK_AT_TITLE_CHAR([Macro with backslash], [macro_backslash], [\]) 855AT_CHECK_AT_TITLE_CHAR([Macro echoing macro], [macro_echo([macro_name])], 856 [macro_expanded]) 857AT_CHECK_AT_TITLE_CHAR([Macro echoing single-quote], [macro_echo(['])], [']) 858AT_CHECK_AT_TITLE_CHAR([Long test title], [0123456789012345678901234567890123]) 859AT_CHECK_AT_TITLE_CHAR([Longer test title], 860 [01234567890123456789012345678901234], [], [], [54]) 861 862 863## ----------------------- ## 864## Long test source lines. ## 865## ----------------------- ## 866 867# Create a test file that has more than 99 words in a line, for Solaris awk. 868# While at that, try out the limit of 2000 bytes in a text file line. 869 870AT_CHECK_AT_TEST([Long test source lines], 871[m4_for([nnn], [1], [999], [], [: ]) 872AT_CHECK([:]) 873], [], [], [], [ignore], [], 874[AT_CHECK([$CONFIG_SHELL ./micro-suite -k skipalltests], [], [ignore], [ignore]) 875]) 876 877 878## ---------------- ## 879## Huge testsuite. ## 880## ---------------- ## 881 882# Ensure we don't hit line length limits with large test suites. 883 884AT_CHECK_AT_TEST([Huge testsuite], 885[m4_for([nnn], [1], [1999], [], 886[AT_CLEANUP 887AT_SETUP([test ]nnn) 888]) 889], [], [], [], [ignore], [], [], [1999]) 890 891 892## ----------------- ## 893## Debugging a test. ## 894## ----------------- ## 895 896AT_CHECK_AT_TEST([Debugging a successful test], 897 [AT_CHECK([:])], [], [], [], [ignore], [], 898[# Without options, when all tests pass, no test directory should exist. 899AT_CHECK([test -d micro-suite.dir/1 && exit 42 900 $CONFIG_SHELL ./micro-suite -d 1], [], [ignore], [ignore]) 901# Running with -d should leave a reproducible test group. 902# Also, running the test script from the test group locks the 903# directory from removal on some platforms; the script should still be 904# able to run even if rmdir fails. 905AT_CHECK([(cd micro-suite.dir/1 && ./run)], [], [ignore], [ignore]) 906# Running a debugging script implies -d. 907AT_CHECK([(cd micro-suite.dir/1 && ./run)], [], [ignore], [ignore]) 908]) 909 910AT_CHECK_AT_TEST([Debugging script and environment], 911 [AT_CHECK([test "$MY_VAR" = pass || exit 42])], 912 [], [1], [], [ignore], [], [ 913# Changing environment outside of debugging script is not preserved. 914AT_CHECK([(cd micro-suite.dir/1 && MY_VAR=pass ./run)], 915 [0], [ignore], [ignore]) 916AT_CHECK([(cd micro-suite.dir/1 && ./run)], 917 [1], [ignore], [ignore]) 918# Changing environment as argument to debugging script is preserved. 919AT_CHECK([(cd micro-suite.dir/1; ./run MY_VAR=pass)], 920 [0], [ignore], [ignore]) 921AT_CHECK([(cd micro-suite.dir/1; ./run)], 922 [0], [ignore], [ignore]) 923]) 924 925# The run script must still be valid when shell metacharacters are passed 926# in via an environment option. 927AT_CHECK_AT_TEST([Debugging a failed test], 928 [AT_CHECK([test "$MY_VAR" = "one space" || exit 42])], 929 [], [1], [], [ignore], [], [ 930AT_CHECK([(cd micro-suite.dir/1 && ./run MY_VAR='two spaces')], 931 [1], [ignore], [ignore]) 932AT_CHECK([(cd micro-suite.dir/1 && ./run MY_VAR='one space')], 933 [0], [ignore], [ignore]) 934]) 935 936 937# Setting default variable values via atlocal. 938AT_CHECK_AT_TEST([Using atlocal], 939 [AT_CHECK([test "x$MY_VAR" = "xodd; 'string" || exit 42])], 940 [], [1], [ignore], [ignore], [], [ 941dnl check that command line can set variable 942AT_CHECK([$CONFIG_SHELL ./micro-suite MY_VAR="odd; 'string"], [0], [ignore]) 943dnl check that command line overrides environment 944AT_CHECK([MY_VAR="odd; 'string" $CONFIG_SHELL ./micro-suite MY_VAR=unset], 945 [1], [ignore], [ignore]) 946dnl check that atlocal can give it a default 947AT_CHECK([cat <<EOF >atlocal 948MY_VAR="odd; 'string" 949export MY_VAR 950dnl Also populate enough of atlocal to do what atconfig normally does. 951at_testdir=. 952abs_builddir='`pwd`' 953at_srcdir=. 954abs_srcdir='`pwd`' 955at_top_srcdir=. 956abs_top_srcdir='`pwd`' 957at_top_build_prefix= 958abs_top_builddir='`pwd`' 959EOF 960]) 961AT_CHECK([$CONFIG_SHELL ./micro-suite], [0], [ignore]) 962dnl check that atlocal overrides environment 963AT_CHECK([MY_VAR=unset $CONFIG_SHELL ./micro-suite], [0], [ignore]) 964dnl check that command line overrides atlocal 965AT_CHECK([$CONFIG_SHELL ./micro-suite MY_VAR=], [1], [ignore], [ignore]) 966dnl check that syntax error is detected 967AT_CHECK([$CONFIG_SHELL ./micro-suite =], [1], [], [ignore], [ignore]) 968AT_CHECK([$CONFIG_SHELL ./micro-suite 1=2], [1], [], [ignore], [ignore]) 969]) 970 971 972# Controlling where the testsuite is run. 973AT_CHECK_AT_TEST([Choosing where testsuite is run], 974 [AT_CHECK([:])], [], [], [], [], [], [ 975dnl AT_CHECK_AT_TEST tests the default of running in `.'. 976AT_CHECK([$CONFIG_SHELL ./micro-suite --clean]) 977AT_CHECK([test -f micro-suite.log], [1]) 978AT_CHECK([test -d micro-suite.dir], [1]) 979AT_CHECK([mkdir sub1 sub2]) 980dnl check specifying a different relative path to run in. 981AT_CHECK([$CONFIG_SHELL ./micro-suite -C sub1], [0], [ignore], []) 982AT_CHECK([test -f micro-suite.log], [1]) 983AT_CHECK([test -f sub1/micro-suite.log], [0]) 984AT_CHECK([test -d micro-suite.dir], [1]) 985AT_CHECK([test -d sub1/micro-suite.dir], [0]) 986AT_CHECK([$CONFIG_SHELL ./micro-suite -C sub1 --clean]) 987AT_CHECK([test -f sub1/micro-suite.log], [1]) 988AT_CHECK([test -d sub1/micro-suite.dir], [1]) 989dnl check specifying an absolute path to run in. 990AT_CHECK([$CONFIG_SHELL ./micro-suite --directory="`pwd`/sub2"], 991 [0], [ignore], []) 992AT_CHECK([test -f micro-suite.log], [1]) 993AT_CHECK([test -f sub2/micro-suite.log], [0]) 994AT_CHECK([$CONFIG_SHELL ./micro-suite --clean --directory="`pwd`/sub2"]) 995AT_CHECK([test -f sub2/micro-suite.log], [1]) 996AT_CHECK([test -f sub2/micro-suite.dir], [1]) 997dnl check for failure detection with bad, missing, or empty directory. 998AT_CHECK([$CONFIG_SHELL ./micro-suite -C nonesuch || exit 1], [1], [ignore], [ignore]) 999AT_CHECK([$CONFIG_SHELL ./micro-suite -C ''], [1], [ignore], [ignore]) 1000AT_CHECK([$CONFIG_SHELL ./micro-suite -C - || exit 1], [1], [ignore], [ignore]) 1001AT_CHECK([$CONFIG_SHELL ./micro-suite -C], [1], [ignore], [ignore]) 1002dnl check that --help overrides bad directory selection. 1003AT_CHECK([$CONFIG_SHELL ./micro-suite -C nonesuch --help], [0], [ignore], []) 1004]) 1005 1006 1007# --recheck. 1008AT_CHECK_AT_TEST([recheck], 1009 [AT_CHECK([:]) 1010 AT_CLEANUP 1011 AT_SETUP([failing test]) 1012 AT_CHECK([exit 1]) 1013 AT_CLEANUP 1014 AT_SETUP([xpassing test]) 1015 AT_XFAIL_IF([:]) 1016 AT_CHECK([:]) 1017 AT_CLEANUP 1018 AT_SETUP([xfailing test]) 1019 AT_XFAIL_IF([:]) 1020 AT_CHECK([exit 1]) 1021], [], [], [], [], [], [ 1022AT_CHECK([$CONFIG_SHELL ./micro-suite --recheck], [0], [stdout]) 1023AT_CHECK([grep "0 tests were successful" stdout], [0], [ignore]) 1024 1025AT_CHECK([$CONFIG_SHELL ./micro-suite], [1], [ignore], [ignore]) 1026AT_CHECK([grep 'only test' micro-suite.log], [0], [ignore]) 1027AT_CHECK([$CONFIG_SHELL ./micro-suite --recheck], [1], [ignore], [ignore]) 1028AT_CHECK([grep 'only test' micro-suite.log], [1]) 1029AT_CHECK([grep 'xfailing' micro-suite.log], [1]) 1030AT_CHECK([grep 'failing test' micro-suite.log], [0], [ignore]) 1031AT_CHECK([grep 'xpassing test' micro-suite.log], [0], [ignore]) 1032 1033AT_CHECK([$CONFIG_SHELL ./micro-suite --clean], [0]) 1034AT_CHECK([test -f micro-suite.log], [1]) 1035 1036dnl check specifying a different relative path to run in. 1037AT_CHECK([mkdir sub1]) 1038AT_CHECK([$CONFIG_SHELL ./micro-suite -C sub1], [1], [ignore], [ignore]) 1039AT_CHECK([test -f micro-suite.log], [1]) 1040AT_CHECK([test -f sub1/micro-suite.log], [0]) 1041AT_CHECK([$CONFIG_SHELL ./micro-suite -C sub1 --recheck --list], [0], [stdout]) 1042AT_CHECK([grep 'only test' stdout], [1]) 1043AT_CHECK([grep 'xfailing test' stdout], [1]) 1044AT_CHECK([grep 'failing test' stdout], [0], [ignore]) 1045AT_CHECK([grep 'xpassing test' stdout], [0], [ignore]) 1046AT_CHECK([$CONFIG_SHELL ./micro-suite -C sub1 --recheck], [1], [ignore], 1047 [ignore]) 1048AT_CHECK([grep 'failing test' sub1/micro-suite.log], [0], [ignore]) 1049AT_CHECK([grep 'xpassing test' sub1/micro-suite.log], [0], [ignore]) 1050], [1 4]) 1051 1052 1053## -------- ## 1054## Banners. ## 1055## -------- ## 1056AT_SETUP([Banners]) 1057 1058AT_CHECK_AT_PREP([b], 1059[[AT_INIT 1060AT_SETUP(zero)# 1 1061AT_CHECK(:) 1062AT_CLEANUP 1063 1064AT_BANNER([first]) 1065AT_SETUP(one a)# 2 1066AT_CHECK(:) 1067AT_CLEANUP 1068AT_SETUP(one b)# 3 1069AT_CHECK(:) 1070AT_CLEANUP 1071 1072AT_BANNER() 1073AT_SETUP(two a)# 4 1074AT_CHECK(:) 1075AT_CLEANUP 1076AT_SETUP(two b)# 5 1077AT_CHECK(:) 1078AT_CLEANUP 1079 1080AT_BANNER([second]) 1081AT_SETUP(three a)# 6 1082AT_CHECK(:) 1083AT_CLEANUP 1084AT_SETUP(three b)# 7 1085AT_CHECK(:) 1086AT_CLEANUP 1087]]) 1088 1089# AT_CHECK_BANNERS(TESTSUITE-OPTIONS, PATTERN1, COUNT1, PATTERN2, COUNT2) 1090m4_define([AT_CHECK_BANNERS], 1091[AT_CHECK([$CONFIG_SHELL ./b $1], [], [stdout]) 1092AT_CHECK_EGREP([$2], m4_if([$3], [0], [1], [0]), [$3]) 1093AT_CHECK_EGREP([$4], m4_if([$5], [0], [1], [0]), [$5]) 1094]) 1095 1096AT_CHECK_BANNERS([], [first], [1], [second], [1]) 1097AT_CHECK_BANNERS([-k zero], [first], [0], [second], [0]) 1098AT_CHECK_BANNERS([1], [first], [0], [second], [0]) 1099AT_CHECK_BANNERS([-2], [first], [1], [second], [0]) 1100AT_CHECK_BANNERS([-3], [first], [1], [second], [0]) 1101AT_CHECK_BANNERS([-k one], [first], [1], [second], [0]) 1102AT_CHECK_BANNERS([3-4], [first], [1], [second], [0]) 1103dnl There should be an empty line separating the first category from the 1104dnl unnamed one. 1105AT_CHECK([sed -n '/one b/,/two a/p' stdout | grep '^$'], [0], [ignore]) 1106AT_CHECK_BANNERS([3-6], [first], [1], [second], [1]) 1107AT_CHECK_BANNERS([4-6], [first], [0], [second], [1]) 1108AT_CHECK_BANNERS([3-], [first], [1], [second], [1]) 1109AT_CHECK_BANNERS([-k a], [first], [1], [second], [1]) 1110AT_CHECK_BANNERS([4], [first], [0], [second], [0]) 1111AT_CHECK_BANNERS([4-], [first], [0], [second], [1]) 1112AT_CHECK_BANNERS([-k two], [first], [0], [second], [0]) 1113AT_CHECK_BANNERS([1 4], [first], [0], [second], [0]) 1114AT_CHECK_BANNERS([-k three], [first], [0], [second], [1]) 1115AT_CHECK_BANNERS([5], [first], [0], [second], [0]) 1116AT_CHECK_BANNERS([5-], [first], [0], [second], [1]) 1117AT_CLEANUP 1118 1119 1120## --------- ## 1121## Keywords. ## 1122## --------- ## 1123AT_SETUP([Keywords and ranges]) 1124 1125AT_CHECK_AT_PREP([k], 1126[[AT_INIT 1127AT_SETUP(none) # 01 1128AT_CHECK(:) 1129AT_CLEANUP 1130AT_SETUP(first) # 02 1131AT_KEYWORDS(key1) 1132AT_CHECK(:) 1133AT_CLEANUP 1134AT_SETUP(second) # 03 1135AT_KEYWORDS(key2) 1136AT_CHECK(:) 1137AT_CLEANUP 1138AT_SETUP(both) # 04 1139AT_KEYWORDS([key1 key2]) 1140AT_KEYWORDS([m4_echo([Key1])]) 1141AT_CHECK(:) 1142AT_CLEANUP 1143AT_SETUP(test5) # 05 1144AT_CHECK(:) 1145AT_CLEANUP 1146AT_SETUP(test6) # 06 1147AT_CHECK(:) 1148AT_CLEANUP 1149AT_SETUP(test7) # 07 1150AT_CHECK(:) 1151AT_CLEANUP 1152AT_SETUP(test8) # 08 1153AT_CHECK(:) 1154AT_CLEANUP 1155AT_SETUP(test9) # 09 1156AT_CHECK(:) 1157AT_CLEANUP 1158AT_SETUP(test10) # 10 1159AT_CHECK(:) 1160AT_CLEANUP 1161]]) 1162dnl check that AT_KEYWORDS does not duplicate words 1163AT_CHECK([grep -i 'key1.*key1' k], [1]) 1164dnl check that -k requires an argument 1165AT_CHECK([$CONFIG_SHELL ./k -k], [1], [], [ignore]) 1166 1167# AT_CHECK_KEYS(TESTSUITE-OPTIONS, PATTERN1, COUNT1, PATTERN2, COUNT2) 1168m4_define([AT_CHECK_KEYS], 1169[AT_CHECK([$CONFIG_SHELL ./k $1], 0, [stdout]) 1170AT_CHECK_EGREP([$2], 0, [$3]) 1171AT_CHECK_EGREP([$4], 1, [$5]) 1172]) 1173 1174AT_CHECK_KEYS([-k key1], [first|both], [2], [none|second], [0]) 1175AT_CHECK_KEYS([-k key2], [second|both], [2], [none|first], [0]) 1176AT_CHECK_KEYS([-k key1,key2], [both], [1], [none|first|second], [0]) 1177AT_CHECK_KEYS([-k key1 -k key2], [first|second|both], [3], [none], [0]) 1178AT_CHECK_KEYS([-k '!key1'], [none|second], [2], [first|both], [0]) 1179AT_CHECK_KEYS([-k '!key2'], [none|first], [2], [second|both], [0]) 1180AT_CHECK_KEYS([-k '!key1,key2'], [second], [1], [none|first|both], [0]) 1181AT_CHECK_KEYS([-k 'key1,!key2'], [first], [1], [none|second|both], [0]) 1182AT_CHECK_KEYS([-k '!key1,!key2'], [none], [1], [first|second|both], [0]) 1183AT_CHECK_KEYS([-k '!key1' -k KEY2], [none|second|both], [3], [first], [0]) 1184AT_CHECK_KEYS([-k key1 -k '!key2'], [none|first|both], [3], [second], [0]) 1185AT_CHECK_KEYS([-k '!KEY1' -k '!key2'], [none|first|second], [3], [both], [0]) 1186 1187AT_CHECK_KEYS([-k none], [none], [1], [first|second|both], [0]) 1188AT_CHECK_KEYS([-k key1,both], [both], [1], [none|first|second], [0]) 1189AT_CHECK_KEYS([-k key1 -k both], [first|both], [2], [none|second], [0]) 1190AT_CHECK_KEYS([-k none,first], [successful], [1], [none|first|second|both], [0]) 1191AT_CHECK_KEYS([-k none,first,second,both], [successful], [1], [none|first|second|both], [0]) 1192AT_CHECK_KEYS([-k !none,first], [first], [1], [none|second|both], [0]) 1193 1194AT_CHECK_KEYS([-k '.*eco.*'], [second], [1], [none|first|both], [0]) 1195AT_CHECK_KEYS([-k 'ECO'], [successful], [1], [none|first|second|both], [0]) 1196AT_CHECK_KEYS([-k '.*eco'], [successful], [1], [none|first|second|both], [0]) 1197AT_CHECK_KEYS([-k 'eco.*'], [successful], [1], [none|first|second|both], [0]) 1198AT_CHECK_KEYS([-k 'fir.*'], [first], [1], [none|second|both], [0]) 1199 1200AT_CHECK_KEYS([1-2], [none|first], [2], [second|both], [0]) 1201AT_CHECK_KEYS([01-002 08], [none|first], [2], [second|both], [0]) 1202AT_CHECK_KEYS([1-3 2-1], [none|first|second], [3], [both], [0]) 1203AT_CHECK_KEYS([-3], [none|first|second], [3], [both], [0]) 1204AT_CHECK_KEYS([4-], [both], [1], [none|first|second], [0]) 1205AT_CHECK_KEYS([010], [test10], [1], [none|first|second|both], [0]) 1206AT_CHECK_KEYS([-k second 4-], [second|both], [2], [none|first], [0]) 1207 1208AT_CHECK([$CONFIG_SHELL ./k 0], [1], [ignore], [ignore]) 1209AT_CHECK([$CONFIG_SHELL ./k 0-], [1], [ignore], [ignore]) 1210AT_CHECK([$CONFIG_SHELL ./k -0], [1], [ignore], [ignore]) 1211AT_CHECK([$CONFIG_SHELL ./k 11], [1], [ignore], [ignore]) 1212AT_CHECK([$CONFIG_SHELL ./k 11-], [1], [ignore], [ignore]) 1213AT_CHECK([$CONFIG_SHELL ./k 1-011], [1], [ignore], [ignore]) 1214AT_CHECK([$CONFIG_SHELL ./k -k nonexistent], [0], [ignore]) 1215 1216AT_CHECK_KEYS([--list -k nonexistent], [KEYWORDS], [1], [first|second|both], [0]) 1217AT_CHECK_KEYS([--list 1], [none], [1], [first|second|both], [0]) 1218AT_CHECK_KEYS([--list 01], [none], [1], [first|second|both], [0]) 1219AT_CHECK_KEYS([--list -k none -k first], [none|first], [2], [second|both], [0]) 1220AT_CLEANUP 1221 1222 1223## ----------------- ## 1224## Keyword wrapping. ## 1225## ----------------- ## 1226AT_SETUP([Keyword wrapping]) 1227 1228AT_CHECK_AT_PREP([k], 1229[[AT_INIT 1230AT_SETUP([test]) 1231AT_KEYWORDS([a1 b1 c1 d1 e1 f1 g1 h1 i1 j1 k1 l1 m1 n1 o1 p1 q1 r1 s1 t1]) 1232AT_KEYWORDS([u1 v1 w1 x1 y1 z1]) 1233AT_KEYWORDS([a b c d e f g h i j k l m n o p q r s t u v w x y z]) 1234AT_CLEANUP 1235AT_SETUP([test with long keywords]) 1236AT_KEYWORDS( 1237[this-is-a-long-keyword-that-cannot-be-wrapped-so-we-exceed-the-length-limit-here]) 1238# surrounded by short ones 1239AT_KEYWORDS([s]) 1240AT_KEYWORDS( 1241[another-very-long-keyword-that-hits-the-line-length-limit-bla-bla-bla-bla]) 1242AT_KEYWORDS([t]) 1243AT_CLEANUP 1244]]) 1245 1246AT_CHECK_KEYS([-l], [.{80}], [1], [.{87}], [0]) 1247 1248AT_CLEANUP 1249 1250 1251## ------------- ## 1252## AT_ARG_OPTION ## 1253## ------------- ## 1254 1255AT_CHECK_AT([AT@&t@_ARG_OPTION], 1256[[ 1257AT_INIT([artificial test suite]) 1258AT_ARG_OPTION([frob fro fr f], 1259 [AS_HELP_STRING([-f, --frob], [frobnicate the test run])], 1260 [frob=$at_optarg], [frob=default]) 1261AT_ARG_OPTION([opt-with-hyphen], 1262 [AS_HELP_STRING([--opt-with-hyphen], [option name with hypen])]) 1263AT_ARG_OPTION([ping], 1264 [AS_HELP_STRING([--ping], [ping on every encounter])], 1265 [echo ping]) 1266AT_SETUP([test argument handling]) 1267AT_CHECK([test "$frob" = "$FROB"]) 1268AT_CHECK([test "$at_arg_frob" = "$FROB_ARG"]) 1269AT_CLEANUP 1270AT_SETUP([test hyphen normalization]) 1271AT_CHECK([test "$at_arg_opt_with_hyphen" = "$expected"]) 1272AT_CLEANUP 1273]], 1274[], [], [stdout], [], [], 1275[# We already invoked --help. 1276AT_CHECK([grep ' -f, --frob.*frobnicate' stdout], [], [ignore]) 1277for args in \ 1278 '1 FROB=default FROB_ARG=false' \ 1279 '1 -f FROB=: FROB_ARG=:' \ 1280 '1 --fr FROB=: FROB_ARG=:' \ 1281 '1 --fro FROB=: FROB_ARG=:' \ 1282 '1 --frob FROB=: FROB_ARG=:' \ 1283 '1 --no-f FROB=false FROB_ARG=false' \ 1284 '1 --no-fr FROB=false FROB_ARG=false' \ 1285 '1 --no-fro FROB=false FROB_ARG=false' \ 1286 '1 --no-frob FROB=false FROB_ARG=false' \ 1287 '2 expected=false' \ 1288 '2 --opt-with-hyphen expected=:' \ 1289 '2 --no-opt-with-hyphen expected=false' 1290do 1291 AT_CHECK([$CONFIG_SHELL ./micro-suite -x $args], [], [ignore]) 1292done 1293AT_CHECK([$CONFIG_SHELL ./micro-suite 2 --ping --no-ping --ping expected=false], 1294 [], [stdout]) 1295AT_CHECK([grep -c ping stdout], [], [[3 1296]]) 1297], [--help]) 1298 1299 1300## ----------------- ## 1301## AT_ARG_OPTION_ARG ## 1302## ----------------- ## 1303 1304AT_CHECK_AT([AT@&t@_ARG_OPTION_ARG], 1305[[ 1306AT_INIT([artificial test suite]) 1307AT_ARG_OPTION_ARG([frob fro fr f], 1308 [AS_HELP_STRING([-f, --frob=FOO], [frobnicate FOO])], 1309 [frob=$at_optarg], [frob=default]) 1310AT_ARG_OPTION_ARG([opt-with-hyphen], 1311 [AS_HELP_STRING([--opt-with-hyphen=ARG], 1312 [option name with hypen])]) 1313AT_ARG_OPTION_ARG([ping], 1314 [AS_HELP_STRING([--ping], [ping on every encounter])], 1315 [echo ping]) 1316AT_SETUP([test argument handling]) 1317AT_CHECK([test "$frob" = "$FROB"]) 1318AT_CHECK([test "$at_arg_frob" = "$FROB_ARG"]) 1319AT_CLEANUP 1320AT_SETUP([test hyphen normalization]) 1321AT_CHECK([test "$at_arg_opt_with_hyphen" = "$expected"]) 1322AT_CLEANUP 1323]], 1324[], [], [stdout], [], [], 1325[# We already invoked --help. 1326AT_CHECK([grep ' -f, --frob.*frobnicate' stdout], [], [ignore]) 1327AT_CHECK([$CONFIG_SHELL ./micro-suite -x --frob], [1], [ignore], [stderr]) 1328AT_CHECK([grep 'requires an argument' stderr], [], [ignore]) 1329AT_CHECK([$CONFIG_SHELL ./micro-suite -x --no-frob], [1], [ignore], [stderr]) 1330AT_CHECK([grep 'invalid option' stderr], [], [ignore]) 1331for args in \ 1332 '1 FROB=default FROB_ARG=' \ 1333 '1 -f bar FROB=bar FROB_ARG=bar' \ 1334 '1 --fr bar FROB=bar FROB_ARG=bar' \ 1335 '1 --fro bar FROB=bar FROB_ARG=bar' \ 1336 '1 --frob bar FROB=bar FROB_ARG=bar' \ 1337 '1 -f=bar FROB=bar FROB_ARG=bar' \ 1338 '1 --fr=bar FROB=bar FROB_ARG=bar' \ 1339 '1 --fro=bar FROB=bar FROB_ARG=bar' \ 1340 '1 --frob=bar FROB=bar FROB_ARG=bar' \ 1341 '2 expected=' \ 1342 '2 --opt-with-hyphen=baz expected=baz' 1343do 1344 AT_CHECK([$CONFIG_SHELL ./micro-suite -x $args], [], [ignore]) 1345done 1346AT_CHECK([$CONFIG_SHELL ./micro-suite 2 --ping=1 --ping=2 expected=], 1347 [], [stdout]) 1348AT_CHECK([grep -c ping stdout], [], [[2 1349]]) 1350], [--help]) 1351 1352 1353m4_define([AT_SKIP_PARALLEL_TESTS], 1354[# Per BUGS, we have not yet figured out how to run parallel tests cleanly 1355# under dash and some ksh variants. For now, only run this test under 1356# limited conditions; help is appreciated in widening this test base. 1357AT_SKIP_IF([${CONFIG_SHELL-$SHELL} -c 'test -z "${BASH_VERSION+set}]]dnl 1358[[${ZSH_VERSION+set}${TEST_PARALLEL_AUTOTEST+set}"']) 1359# The parallel scheduler requires mkfifo and job control to work. 1360AT_CHECK([mkfifo fifo || exit 77]) 1361AT_CHECK([${CONFIG_SHELL-$SHELL} -c '(set -m && set +m) || exit 77'], 1362 [], [], [ignore]) 1363]) 1364 1365 1366## ----------------------- ## 1367## parallel test execution ## 1368## ----------------------- ## 1369 1370AT_SETUP([parallel test execution]) 1371 1372# This test tries to ensure that -j runs tests in parallel. 1373# Such a test is inherently racy, because there are no real-time 1374# guarantees about scheduling delays. So we try to minimize 1375# the chance to lose the race. 1376 1377# The time needed for a micro-suite consisting of NTESTS tests each 1378# sleeping for a second is estimated by 1379# startup + ntests * (serial_overhead + 1 / njobs) 1380# 1381# in absence of major scheduling delays. This leads to side conditions: 1382# - NTESTS should be high, so the STARTUP time is small compared to the 1383# test run time, and scheduling delays can even out; it should not be 1384# too high, to not slow down the testsuite unnecessarily, 1385# - the number of concurrent jobs NJOBS should not be too low, so the 1386# race is not lost so easily; it should not be too high, to avoid fork 1387# failures on tightly limited systems. 4 seems a good compromise 1388# here, considering that Autotest spawns several other processes. 1389# - STARTUP is assumed to be the same for parallel and serial runs, so 1390# the latter can estimate the former. 1391# - To avoid unportable output from time measurement commands, spawn 1392# both a parallel and a serial testsuite run; check that the former 1393# completes before the latter has completed a fraction SERIAL_NTESTS 1394# of the tests (the serial run is executed in a subdirectory), plus 1395# some additional time to allow for compensation of SERIAL_OVERHEAD. 1396# - when adding this time to the serial test execution, an initial delay 1397# SERIAL_DELAY of the serial test helps to avoid unreliable scheduling 1398# due to the startup burst of the suites. 1399 1400dnl total number of tests. 1401m4_define([AT_PARALLEL_NTESTS], [16]) 1402dnl number of jobs to run in parallel. 1403m4_define([AT_PARALLEL_NJOBS], [4]) 1404dnl number of tests to run serially, as comparison. 1405m4_define([AT_PARALLEL_SERIAL_NTESTS], 1406 m4_eval(AT_PARALLEL_NTESTS / AT_PARALLEL_NJOBS)) 1407dnl initial delay of serial run, to compensate for SERIAL_OVERHEAD. 1408dnl This corresponds to 0.67 s of overhead per test. 1409m4_define([AT_PARALLEL_SERIAL_DELAY], 1410 m4_eval((AT_PARALLEL_NTESTS - AT_PARALLEL_SERIAL_NTESTS + 1) * 2 / 3)) 1411 1412 1413AT_CHECK_AT_PREP([micro-suite], 1414[[AT_INIT([suite to test parallel execution]) 1415m4_for([count], [1], ]]AT_PARALLEL_NTESTS[[, [], 1416 [AT_SETUP([test number count]) 1417 AT_CHECK([sleep 1]) 1418 AT_CLEANUP 1419]) 1420]]) 1421 1422# Even if parallel jobs are not supported, the command line must work. 1423AT_CHECK([$CONFIG_SHELL ./micro-suite --help | grep " --jobs"], [0], [ignore]) 1424AT_CHECK([$CONFIG_SHELL ./micro-suite -j2foo], [1], [], [stderr]) 1425AT_CHECK([grep 'non-numeric argument' stderr], [], [ignore]) 1426AT_CHECK([$CONFIG_SHELL ./micro-suite --jobs=foo], [1], [], [stderr]) 1427AT_CHECK([grep 'non-numeric argument' stderr], [], [ignore]) 1428 1429AT_SKIP_PARALLEL_TESTS 1430 1431# Ensure that all tests run, and lines are not split. 1432AT_CHECK([$CONFIG_SHELL ./micro-suite -j[]AT_PARALLEL_NJOBS], [], [stdout]) 1433AT_CHECK([grep -c '^.\{53\}ok' stdout], [], [AT_PARALLEL_NTESTS 1434]) 1435# Running one test with -j should produce correctly formatted output: 1436AT_CHECK([$CONFIG_SHELL ./micro-suite -j 3], [], [stdout]) 1437AT_CHECK([grep -c '^.\{53\}ok' stdout], [], [1 1438]) 1439# Specifying more jobs than tests should not hang: 1440AT_CHECK([$CONFIG_SHELL ./micro-suite -j3 3], [], [stdout]) 1441AT_CHECK([grep -c '^.\{53\}ok' stdout], [], [1 1442]) 1443# Not even with zero tests: 1444AT_CHECK([$CONFIG_SHELL ./micro-suite -j -k nomatch], [], [ignore]) 1445AT_CHECK([$CONFIG_SHELL ./micro-suite -j3 -k nomatch], [], [ignore]) 1446 1447mkdir serial 1448 1449# Unfortunately, the return value of wait is unreliable, 1450# so we check that kill fails. 1451AT_CHECK([$CONFIG_SHELL ./micro-suite --jobs=[]AT_PARALLEL_NJOBS & ]dnl 1452 [sleep AT_PARALLEL_SERIAL_DELAY && ]dnl 1453 [cd serial && $CONFIG_SHELL ../micro-suite -AT_PARALLEL_SERIAL_NTESTS >/dev/null && ]dnl 1454 [{ kill $! && exit 1; :; }], [], [stdout], [ignore]) 1455AT_CHECK([grep -c '^.\{53\}ok' stdout], [], [AT_PARALLEL_NTESTS 1456]) 1457AT_CHECK([grep 'AT_PARALLEL_NTESTS tests' stdout], [], [ignore]) 1458 1459AT_CLEANUP 1460 1461AT_CHECK_AT_TEST([parallel truth], 1462 [AT_CHECK([:], 0, [], [])], 1463 [], [], [], [], [AT_SKIP_PARALLEL_TESTS], 1464 [], [-j]) 1465 1466AT_CHECK_AT_TEST([parallel fallacy], 1467 [AT_CHECK([false], [], [], [])], 1468 [], [1], [], [ignore], [AT_SKIP_PARALLEL_TESTS], 1469 [AT_CHECK([grep failed micro-suite.log], [], [ignore])], [-j]) 1470 1471AT_CHECK_AT_TEST([parallel skip], 1472 [AT_CHECK([echo output; echo irrelevant >&2; exit 77], 0, [mismatch], [])], 1473 [], [], [], [], [AT_SKIP_PARALLEL_TESTS], 1474 [AT_CHECK([grep skipped micro-suite.log], [], [ignore])], [-j]) 1475 1476AT_CHECK_AT_TEST([parallel syntax error], 1477 [AT_CHECK([:]) 1478 AT_CLEANUP 1479 AT_SETUP([syntax]) 1480 AT_CHECK([if]) 1481 AT_CLEANUP 1482 AT_SETUP([another test]) 1483 AT_CHECK([:])], 1484 [], [0], [], [], [AT_SKIP_PARALLEL_TESTS], 1485 [dnl Until we can find a way to avoid catastrophic failure (ash) or 1486 dnl lack of failure (zsh), skip the rest of this test on such shells. 1487 echo 'if' > syntax 1488 AT_CHECK([${CONFIG_SHELL-$SHELL} -c 'case `. ./syntax; echo $?` in 1489 0|"") exit 77;; 1490 esac'], [0], [ignore], [ignore]) 1491 AT_CHECK([$CONFIG_SHELL ./micro-suite -j], [1], [ignore], [stderr]) 1492 AT_CHECK([grep "unable to parse test group: 2" stderr], [0], [ignore])], 1493 [-j2 1 3]) 1494 1495AT_CHECK_AT_TEST([parallel errexit], 1496 [AT_CHECK([false]) 1497 AT_CLEANUP 1498 AT_SETUP([barrier test]) 1499 AT_CHECK([sleep 4]) 1500 AT_CLEANUP 1501 AT_SETUP([test that should not be run]) 1502 AT_CHECK([:])], 1503 [], [1], [stdout], [stderr], [AT_SKIP_PARALLEL_TESTS], 1504 [AT_CHECK([test -f micro-suite.log], [1]) 1505 touch micro-suite.log # shut up AT_CAPTURE_FILE. 1506 AT_CHECK([grep "should not be run" stdout], [1]) 1507 AT_CHECK([grep "[[12]] .* inhibited subsequent" stderr], [], [ignore])], 1508 [-j2 --errexit]) 1509 1510 1511AT_SETUP([parallel autotest and signal handling]) 1512 1513AT_SKIP_PARALLEL_TESTS 1514 1515# Goals: 1516# (1) interrupt `./testsuite -jN' 1517# (2) interrupt `make check TESTSUITEFLAGS=-jN' 1518# (3) no trailing verbose/trace output 1519# (4) exit status should be 128+signal 1520 1521AT_DATA([atlocal], 1522[[suite_pid=$$ 1523export suite_pid 1524]]) 1525 1526AT_CHECK_AT_PREP([micro-suite], 1527[[AT_INIT([suite to test parallel execution]) 1528AT_SETUP([test number 1]) 1529AT_CHECK([sleep 2]) 1530AT_CLEANUP 1531AT_SETUP([test number 2]) 1532AT_CHECK([sleep 1]) 1533AT_CLEANUP 1534AT_SETUP([test number 3]) 1535AT_CHECK([sleep 1]) 1536AT_CLEANUP 1537AT_SETUP([killer test]) 1538AT_CHECK([kill -$signal $suite_pid]) 1539AT_CLEANUP 1540m4_for([count], [5], [7], [], 1541 [AT_SETUP([test number count]) 1542 AT_CHECK([sleep 1]) 1543 AT_CLEANUP 1544]) 1545]]) 1546 1547AT_DATA([Makefile.in], 1548[[@SET_MAKE@ 1549SHELL = @SHELL@ 1550TESTSUITE = ./micro-suite 1551check: 1552 $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) 1553.PHONY: check 1554]]) 1555 1556AT_CHECK([$CONFIG_SHELL $abs_top_builddir/config.status --file=Makefile:Makefile.in], 1557 [], [ignore]) 1558 1559# Test INT and TERM. 1560for signal in 2 15; do 1561 export signal 1562 AS_VAR_ARITH([expected_status], [128 + $signal]) 1563 1564 # Sequential case. 1565 AT_CHECK([$CONFIG_SHELL ./micro-suite], [$expected_status], 1566 [ignore], [stderr]) 1567 # Both stderr and the log should contain the notification about the signal. 1568 AT_CHECK([grep 'bailing out' stderr], [], [ignore]) 1569 AT_CHECK([grep 'bailing out' micro-suite.log], [], [ignore]) 1570 # There should be no junk job status output. 1571 AT_CHECK([[grep '[iI]nterrupt[ ]' stderr]], [1]) 1572 1573 # Parallel case. 1574 AT_CHECK([$CONFIG_SHELL ./micro-suite --jobs=3], [$expected_status], 1575 [ignore], [stderr]) 1576 AT_CHECK([grep 'bailing out' stderr], [], [ignore]) 1577 AT_CHECK([grep 'bailing out' micro-suite.log], [], [ignore]) 1578 # We'd like to check this here, too, but some shells do not allow to 1579 # turn off job control. 1580 # AT_CHECK([[grep '[iI]nterrupt[ ]' stderr]], [1]) 1581 1582 # Ditto with `make' in the loop. 1583 : "${MAKE=make}" 1584 unset MAKEFLAGS 1585 # Need to eliminate outer TESTSUITEFLAGS here. 1586 # Need to normalize exit status here: some make implementations 1587 # exit 1 (BSD make), some exit 2 (GNU make). 1588 AT_CHECK([$MAKE check TESTSUITEFLAGS=; ]dnl 1589 [case $? in 1|2) exit 1;; *) exit $?;; esac], 1590 [1], [ignore], [stderr]) 1591 AT_CHECK([grep 'bailing out' stderr], [], [ignore]) 1592 AT_CHECK([grep 'bailing out' micro-suite.log], [], [ignore]) 1593 # Ditto, parallel case. 1594 AT_CHECK([$MAKE check TESTSUITEFLAGS=--jobs=3; ]dnl 1595 [case $? in 1|2) exit 1;; *) exit $?;; esac], 1596 [1], [ignore], [stderr]) 1597 AT_CHECK([grep 'bailing out' stderr], [], [ignore]) 1598 AT_CHECK([grep 'bailing out' micro-suite.log], [], [ignore]) 1599done 1600 1601 1602# Test PIPE. 1603# The most important part here is that things should not hang, nor 1604# get out of hand. OTOH, if the shell sets the default handler to 1605# ignore PIPE (pdksh, dash), there is little we can do about having the 1606# test run; it's only the output that won't be there. So all we check 1607# for is that, if test 7 didn't run serially, then it shouldn't be 1608# run in the parallel case either; the intermediate tests serve as 1609# parallel barrier. 1610# Note that stderr may contain "Broken pipe" errors. 1611AT_CHECK([($CONFIG_SHELL ./micro-suite -d -3 5-; echo $? >status) | sed 5q], 1612 [], [stdout], [stderr]) 1613AT_CHECK([grep '5.*ok' stdout], [1]) 1614# Apparently some shells don't get around to creating 'status' any more. 1615# And ksh93 on FreeBSD uses 256 + 13 instead of 128 + 13 1616AT_CHECK([test ! -s status || grep 141 status || grep 269 status], 1617 [], [ignore]) 1618AT_CHECK([if test -f micro-suite.dir/7/micro-suite.log; then ]dnl 1619 [ echo "shell ignores SIGPIPE" > sigpipe-stamp ]dnl 1620 [else :; fi]) 1621 1622AT_CHECK([$CONFIG_SHELL ./micro-suite -d -3 5- --jobs=2 | sed 5q], [], [stdout], [ignore]) 1623AT_CHECK([grep '5.*ok' stdout], [1]) 1624AT_CHECK([test -s sigpipe-stamp || test ! -f micro-suite.dir/7/micro-suite.log], [0]) 1625 1626AT_CLEANUP 1627 1628 1629# Avoid running into a regression when mkfifo does not work. 1630AT_CHECK_AT_TEST([parallel args but non-working mkfifo], 1631[AT_CHECK([:]) 1632AT_CLEANUP 1633AT_SETUP([second test]) 1634AT_CHECK([:]) 1635], 1636[], [], [stdout], [stderr], 1637[AT_SKIP_PARALLEL_TESTS 1638mkdir bin 1639cat >bin/mkfifo <<\EOF 1640#! /bin/sh 1641exit 1 1642EOF 1643chmod +x bin/mkfifo 1644PATH=`pwd`/bin:$PATH 1645export PATH 1646], 1647[AT_CHECK([grep 'second test' stdout], [], [ignore]) 1648], [--jobs]) 1649 1650 1651# --color 1652AT_CHECK_AT_TEST([colored test results], 1653 [AT_CHECK([:]) 1654 AT_CLEANUP 1655 AT_SETUP([fail]) 1656 AT_CHECK([exit 1]) 1657 AT_CLEANUP 1658 AT_SETUP([xpass]) 1659 AT_XFAIL_IF([:]) 1660 AT_CHECK([:]) 1661 AT_CLEANUP 1662 AT_SETUP([xfail]) 1663 AT_XFAIL_IF([:]) 1664 AT_CHECK([exit 1]) 1665 AT_CLEANUP 1666 AT_SETUP([skip]) 1667 AT_CHECK([exit 77]) 1668 AT_CLEANUP 1669 AT_SETUP([hardfail]) 1670 AT_XFAIL_IF([:]) 1671 AT_CHECK([exit 99]) 1672], [], [], [], [], [], [ 1673 1674TERM=ansi 1675export TERM 1676 1677red=`printf '\033@<:@0;31m'` 1678grn=`printf '\033@<:@0;32m'` 1679lgn=`printf '\033@<:@1;32m'` 1680blu=`printf '\033@<:@1;34m'` 1681std=`printf '\033@<:@m'` 1682 1683# Check that grep can parse nonprinting characters. 1684# BSD 'grep' works from a pipe, but not a seekable file. 1685# GNU or BSD 'grep -a' works on files, but is not portable. 1686AT_CHECK([case `echo "$std" | grep .` in #'' restore font-lock 1687 $std) :;; 1688 *) exit 77;; 1689 esac], [], [ignore], [], 1690 [echo "grep can't parse nonprinting characters" >&2]) 1691 1692if echo 'ab*c' | grep -F 'ab*c' >/dev/null 2>&1; then 1693 FGREP="grep -F" 1694else 1695 FGREP=fgrep 1696fi 1697 1698# No color. 1699AT_CHECK([$CONFIG_SHELL ./micro-suite], [1], [stdout], [stderr]) 1700for color in "$red" "$grn" "$lgn" "$blu"; do 1701 AT_CHECK([cat stdout stderr | $FGREP "$color"], [1]) 1702done 1703 1704# Color of test group results. 1705AT_CHECK([$CONFIG_SHELL ./micro-suite --color=always], [1], [stdout], [stderr]) 1706AT_CHECK([cat stdout | grep " only " | $FGREP "$grn"], [], [ignore]) 1707AT_CHECK([cat stdout | grep " fail " | $FGREP "$red"], [], [ignore]) 1708AT_CHECK([cat stdout | grep " xfail " | $FGREP "$lgn"], [], [ignore]) 1709AT_CHECK([cat stdout | grep " xpass " | $FGREP "$red"], [], [ignore]) 1710AT_CHECK([cat stdout | grep " skip " | $FGREP "$blu"], [], [ignore]) 1711AT_CHECK([cat stdout | grep " hardfail " | $FGREP "$red"], [], [ignore]) 1712AT_CHECK([cat stderr | grep ERROR | $FGREP "$red"], [], [ignore]) 1713 1714# The summary is green if all tests were successful, light green if all 1715# behaved as expected, and red otherwise. 1716AT_CHECK([$CONFIG_SHELL ./micro-suite --color=always 1 -k skip], 1717 [0], [stdout]) 1718AT_CHECK([cat stdout | grep 'test.*successful' | $FGREP "$grn"], 1719 [], [ignore]) 1720AT_CHECK([$CONFIG_SHELL ./micro-suite --color=always 1 -k xfail -k skip], 1721 [0], [stdout]) 1722AT_CHECK([cat stdout | grep 'as expected' | $FGREP "$lgn"], [], [ignore]) 1723AT_CHECK([$CONFIG_SHELL ./micro-suite --color=always -k fail], 1724 [1], [ignore], [stderr]) 1725AT_CHECK([cat stderr | grep ERROR | $FGREP "$red"], [], [ignore]) 1726AT_CHECK([$CONFIG_SHELL ./micro-suite --color=always -k xpass], 1727 [1], [ignore], [stderr]) 1728AT_CHECK([cat stderr | grep ERROR | $FGREP "$red"], [], [ignore]) 1729AT_CHECK([$CONFIG_SHELL ./micro-suite --color=always -k hardfail], 1730 [1], [ignore], [stderr]) 1731AT_CHECK([cat stderr | grep ERROR | $FGREP "$red"], [], [ignore]) 1732# Reset color on verbose output. 1733printf %s\\n "$std" 1734], [1]) 1735 1736 1737## ------------------- ## 1738## srcdir propagation. ## 1739## ------------------- ## 1740 1741AT_SETUP([srcdir propagation]) 1742 1743mkdir pkg vpath-outside vpath-abs 1744mkdir pkg/t pkg/vpath-inside 1745AT_DATA([pkg/a]) 1746AT_DATA([pkg/t/b]) 1747 1748AT_DATA([pkg/configure.ac], [[AC_INIT 1749AC_CONFIG_TESTDIR([t]) 1750AC_OUTPUT 1751]]) 1752cp "$abs_top_srcdir/build-aux/install-sh" pkg 1753 1754cd pkg 1755AT_CHECK_AUTOCONF 1756cd .. 1757 1758AT_CHECK_AT_PREP([suite], 1759[[AT_INIT([suite to check srcdir]) 1760AT_SETUP([my only test]) 1761AT_CHECK([test -f "$top_srcdir"/a && test -f "$srcdir"/b]) 1762AT_CLEANUP 1763]], [], [], [], [pkg/t]) 1764 1765rm -f pkg/t/atconfig 1766 1767# Build directory totally outside source directory. 1768cd vpath-outside 1769AT_CHECK([../pkg/configure $configure_options], [0], [ignore]) 1770cd t 1771AT_CHECK([../../pkg/t/suite], [0], [ignore]) 1772AT_CHECK([../../pkg/t/suite -v], [0], [stdout]) 1773AT_CHECK([grep '^\.\./\.\./pkg/t/suite.at' stdout], [0], [ignore]) 1774cd ../.. 1775 1776# Build directory totally outside source directory (absolute). 1777my_srcdir=`pwd`/pkg 1778cd vpath-abs 1779AT_CHECK(["$my_srcdir"/configure $configure_options], [0], [ignore]) 1780cd t 1781AT_CHECK(["$my_srcdir"/t/suite], [0], [ignore]) 1782AT_CHECK(["$my_srcdir"/t/suite -v], [0], [stdout]) 1783AT_CHECK([grep '..*/t/suite.at' stdout], [0], [ignore]) 1784cd ../.. 1785 1786# Build directory as subdirectory of source directory. 1787cd pkg/vpath-inside 1788AT_CHECK([../configure $configure_options], [0], [ignore]) 1789cd t 1790AT_CHECK([../../t/suite], [0], [ignore]) 1791AT_CHECK([../../t/suite -v], [0], [stdout]) 1792AT_CHECK([grep '^\.\./\.\./t/suite.at' stdout], [0], [ignore]) 1793cd ../../.. 1794 1795# Build directory as parent of source directory. 1796AT_CHECK([pkg/configure $configure_options], [0], [ignore]) 1797cd t 1798AT_CHECK([../pkg/t/suite], [0], [ignore]) 1799AT_CHECK([../pkg/t/suite -v], [0], [stdout]) 1800AT_CHECK([grep '^\.\./pkg/t/suite.at' stdout], [0], [ignore]) 1801cd .. 1802 1803# Build directory as source directory. 1804cd pkg 1805AT_CHECK_CONFIGURE 1806cd t 1807AT_CHECK([./suite], [0], [ignore]) 1808AT_CHECK([./suite -v], [0], [stdout]) 1809AT_CHECK([grep '^\./suite.at' stdout], [0], [ignore]) 1810cd ../.. 1811 1812AT_CLEANUP 1813 1814 1815## ------------------------------ ## 1816## whitespace in absolute testdir ## 1817## ------------------------------ ## 1818 1819AT_SETUP([whitespace in absolute testdir]) 1820 1821dir='dir with whitespace' 1822mkdir "$dir" 1823cd "$dir" 1824wd=`pwd` 1825 1826AT_DATA([a]) 1827AT_CHECK_AT_PREP([suite], 1828[[AT_INIT([suite to check srcdir]) 1829AT_SETUP([my only test]) 1830AT_CHECK([test -f "$top_srcdir"/a]) 1831AT_CLEANUP 1832]]) 1833AT_CHECK([top_srcdir=$wd ./suite], [0], [ignore]) 1834AT_CHECK([top_srcdir=$wd ./suite -d], [0], [ignore]) 1835AT_CHECK([cd suite.dir/1 && ./run top_srcdir="$wd"], [0], [ignore], [ignore]) 1836AT_CLEANUP 1837 1838 1839## ------------------ ## 1840## unusual file names ## 1841## ------------------ ## 1842 1843AT_SETUP([unusual file names]) 1844 1845AT_DATA_AUTOTEST([d@&t@nl.at], 1846[[AT_SETUP([test one]) 1847m4_pattern_allow([^dnl$]) 1848AT_CHECK([test "]m4_dquote(AT_LINE)[" = dn[]l.at:3]) 1849AT_CLEANUP 1850]]) 1851 1852mkdir sub 1853AT_DATA_AUTOTEST([sub/"two spaces".at], 1854[[AT_SETUP([test two]) 1855AT_CHECK([test "]m4_dquote(AT_LINE)[" = "two spaces.at:2"]) 1856AT_CLEANUP 1857]]) 1858 1859AT_CHECK_AT_PREP([suite], 1860[[AT_INIT([suite to check included file names]) 1861m4_include([d][nl.at]) 1862m4_include([sub/two spaces.at]) 1863]]) 1864AT_CHECK([$CONFIG_SHELL ./suite], [0], [stdout]) 1865AT_CHECK([grep 'two spaces' suite.log], [1]) 1866AT_CLEANUP 1867 1868 1869## ------------------------- ## 1870## Erlang EUnit unit tests. ## 1871## ------------------------- ## 1872 1873AT_SETUP([Erlang Eunit unit tests]) 1874AT_KEYWORDS([Erlang]) 1875 1876mkdir s t 1877AT_DATA([configure.ac], [[AC_INIT 1878AC_ERLANG_PATH_ERL([no]) 1879AC_ERLANG_PATH_ERLC([no]) 1880if test "$ERL" = "no" || test "$ERLC" = "no"; then 1881 HAVE_ERLANG=no 1882 HAVE_EUNIT=no 1883else 1884 HAVE_ERLANG=yes 1885 AC_ERLANG_CHECK_LIB([eunit], [HAVE_EUNIT=yes], [HAVE_EUNIT=no]) 1886fi 1887AC_SUBST([HAVE_ERLANG]) 1888AC_SUBST([HAVE_EUNIT]) 1889 1890AC_CONFIG_TESTDIR([t]) 1891AC_CONFIG_FILES([s/compile], [chmod +x s/compile]) 1892AC_CONFIG_FILES([erlang.conf]) 1893AC_OUTPUT 1894]]) 1895 1896# File to pass info back to us 1897AT_DATA([erlang.conf.in], 1898[[HAVE_ERLANG=@HAVE_ERLANG@ 1899HAVE_EUNIT=@HAVE_EUNIT@ 1900]]) 1901 1902# Erlang module to test: 1903AT_DATA([s/testme.erl], 1904[[-module(testme). 1905-export([foo/1]). 1906foo(1) -> one; 1907foo(2) -> two; 1908foo(_) -> other. 1909]]) 1910 1911# Corresponding Eunit unit test module: 1912AT_DATA([s/testme_tests.erl], 1913[[-module(testme_tests). 1914-include_lib("eunit/include/eunit.hrl"). 1915foo_one_test() -> ?assertEqual(one, testme:foo(1)). 1916foo_two_test() -> ?assertEqual(two, testme:foo(2)). 1917foo_other_test() -> ?assertEqual(other, testme:foo(42)). 1918]]) 1919 1920# Compilation script: 1921AT_DATA([s/compile.in], 1922[["@ERLC@" -b beam testme.erl testme_tests.erl 1923]]) 1924 1925AT_CHECK_AT_PREP([suite], 1926[[AT_INIT([suite to check EUnit integration]) 1927AT_SETUP([my only test]) 1928AT_CHECK_EUNIT([my_testsuite], [{module, testme}], 1929 [-pa "${abs_top_builddir}/s"]) 1930AT_CLEANUP 1931]], [], [], [], [t]) 1932 1933AT_CHECK_AUTOCONF 1934AT_CHECK_CONFIGURE 1935. ./erlang.conf 1936 1937AT_CHECK([grep '^ERL='\''.*'\' t/atconfig], [], [ignore]) 1938AT_CHECK([grep '^ERLC='\''.*'\' t/atconfig], [], [ignore]) 1939AT_CHECK([grep '^ERLCFLAGS='\''.*'\' t/atconfig], [], [ignore]) 1940 1941if test "$HAVE_ERLANG" = yes && test "$HAVE_EUNIT" = yes; then 1942 AT_CHECK([cd s && $CONFIG_SHELL ./compile]) 1943fi 1944 1945AT_CHECK([cd t && $CONFIG_SHELL ./suite], [], [ignore]) 1946 1947if test "$HAVE_EUNIT" = yes; then 1948 AT_CHECK([grep 1.*successful t/suite.log], [], [ignore]) 1949 AT_CHECK([grep skipped t/suite.log], [1], [ignore]) 1950else 1951 AT_CHECK([grep 1.*skipped t/suite.log], [], [ignore]) 1952 AT_CHECK([grep 0.*successful t/suite.log], [], [ignore]) 1953fi 1954 1955AT_CLEANUP 1956