summaryrefslogtreecommitdiff
path: root/t/run
Commit message (Collapse)AuthorAgeFilesLines
* Move some tests from cpan/version to t/runKarl Williamson2013-07-191-4/+35
| | | | | | | | | | | | | | | | | | Commit fb7942811c8097ed2e61fd35a90345226546176a recently moved version.pm to cpan. Earlier, in commit b127e37e51c21b0a36755dcd19811be931a03d83, I had added tests to version's .t that arguably belonged elsewhere. I did this because I thought that this .t was the only one around that had the infrastructure already written to allow such tests to easily be added, and it was in /lib so p5p controlled it. (That infrastructure being finding locales with the decimal point not a dot.) Since then, I found that t/run/locale.t has similar infrastructure. Given that version now may end up being cpan upstream, I thought it best to move those tests to t/run/locale.t I notice that changes to this .t prior to these no longer were careful to avoid 'use locale' in case the platform doesn't support it, and there have been no field problems; so I just went ahead and did a 'use locale' too.
* switchd.t: correct bug numberFather Chrysostomos2013-07-111-1/+1
|
* [perl #118627] Don’t do COW when creating ${"_<-e"}[0]Father Chrysostomos2013-07-111-1/+12
| | | | | | | | | | | | | | | | | | | | | | The lexer does not expect PL_linestr (an SV holding the current line of Perl code being parsed) to do copy-on-write. It expects to be able to manipulate that SV to its hearts content with impunity. The one piece of code that can cause it to do that is S_update_debugger_info, when called with a SV for the first argument. The only time it is called that way is for line 0 of the main script, containing state- ments generated from command line arguments (e.g., ‘use strict’ from ‘-Mstrict’), and it is called with PL_linestr as its argument. If ${"_<-e"}[0] ends up sharing the buffer with PL_linestr, bad things will happen, as the lexer is going to continue to modify that buffer. Usually we get this: $ ./perl -It/lib -d:switchd_empty -e'print @{"_<-e"}' |less ^@se Devel::switchd_empty; print @{"_<-e"} So force S_update_debugger_info to do a non-COW copy.
* We don't actually need to set $ENV{PERL} for the tests to work.Nicholas Clark2013-07-011-1/+1
| | | | | | Whatever the executable is named at the top level, it's always symlinked as ./perl in t, so there's no need to set an environment variable to override the expected name.
* dtrace.t: Don’t rely on installed strict.pmFather Chrysostomos2013-06-041-0/+1
| | | | It was failing to load strict.pm if perl had not been installed yet.
* cleanup and test PERL_PERTURB_KEYS environment variable handlingYves Orton2013-05-081-1/+48
|
* Make smartmatch, given & when experimentalBrian Fraser2013-03-261-2/+2
|
* RT-116192 - If a directory in @INC already has a trailing '/', don't add ↵Matthew Horsfall (alh)2013-02-102-0/+27
| | | | another.
* Enable perl core tests to pass when locale support is not available.Jess Robinson2013-02-091-5/+14
| | | | | | | | use locale - this will now die if $Config{d_setlocale} is not true. All tests that use locale will skip if $Config{d_setlocale} is not true. This enables us to pass tests on Android which uses ICU instead of locales. The committer removed trailing white space
* Note why switchF1.t and switchp.t do not use test.pl.James E Keenan2013-01-222-0/+7
| | | | | | Patches submitted by Marcel Gruenauer. For RT #116507 and 116517.
* syntax check a directory: set the test process locale tooTony Cook2013-01-221-0/+2
|
* further refinement to EISDIR tests from `perl dir`Ricardo Signes2013-01-181-3/+2
| | | | | | | | 1. actually use the EISDIR string, rather than getting it and not using it; this was a refactoring screw-up 2. don't hardcode the Win32 EACCES error, either, use the same "$!" mechanism
* in testing EISDIR string, check known value firstRicardo Signes2013-01-161-5/+6
| | | | | | | It was not enough to ensure the English value, as some platforms use a different string entirely. Rather than goof around with figuring them out, just get the known value by making an EISDIR and stringifying it, then compare to that.
* avoid having to worry whether the test runs in a localeRicardo Signes2013-01-151-0/+4
| | | | | | This is a time-honored tradition from such places as t/op. Tony Cook alerted me to failures caused by this test on machines smoking in non-English locales.
* expect a different error for `perl dir` on Win32Ricardo Signes2013-01-121-1/+5
| | | | | | | We've known that this is how Win32 behaves, as it was documented in the ticket for which this is a fix. I don't think it's worth the bother of ensuring we get EISDIR, as long as we don't just exit silently!
* Add a test to detect error when attempting to syntax-check a directory.James E Keenan2013-01-121-1/+12
| | | | For: RT #61362
* Adjust MANIFEST, Makefiles, test harnesses, documentation, etc., aware of newJames E Keenan2012-12-071-1/+1
| | | | | | directory t/opbasic. For RT #115838
* Add descriptions to tests lacking them.James E Keenan2012-11-291-5/+10
| | | | Accomplished programmatically by modifying sub try().
* t/run/switchx.t: Add descriptions to tests lacking them.James E Keenan2012-11-292-4/+4
| | | | | | | The tests which lacked descriptions are in sample files used by the test file. Better description as suggested by Lukas Mai. For: RT #115782
* t/run/switchF1.t: Add descriptions to tests in t/run/switchF1.t.James E Keenan2012-11-291-5/+7
| | | | For: RT #115896
* t/run/script.t: Add descriptions to all tests.James E Keenan2012-11-291-5/+4
| | | | | | | Replace hard-coded tests with functions from test.pl. Correct error in calling plan. For: RT #115776
* t/run/switchd.t: Add descriptions to tests lacking them.James E Keenan2012-11-291-3/+9
| | | | For: RT #115784
* t/run/switchp.t: Add descriptions to all tests.James E Keenan2012-11-291-3/+3
| | | | For: RT #115780
* t/run/switchI.t: Add descriptions to tests lacking them.James E Keenan2012-11-291-2/+3
| | | | | | | | | This entailed placing the 'grep' in a 'do' block. Trying to add the description without the 'do' block merely added it to the list being grepped -- which prevented the description from being printed. Thanks to Matt Follett and Steve Lembark at St. Louis Perl Hackathon for diagnosis.
* Hash Function Change - Murmur hash and true per process hash seedYves Orton2012-11-171-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does the following: *) Introduces multiple new hash functions to choose from at build time. This includes Murmur-32, SDBM, DJB2, SipHash, SuperFast, and One-at-a-time. Currently this is handled by muning hv.h. Configure support hopefully to follow. *) Changes the default hash to Murmur hash which is faster than the old default One-at-a-time. *) Rips out the old HvREHASH mechanism and replaces it with a per-process random hash seed. *) Changes the old PL_hash_seed from an interpreter value to a global variable. This means it does not have to be copied during interpreter setup or cloning. *) Changes the format of the PERL_HASH_SEED variable to a hex string so that hash seeds longer than fit in an integer are possible. *) Changes the return of Hash::Util::hash_seed() from a number to a string. This is to accomodate hash functions which have more bits than can be fit in an integer. *) Adds new functions to Hash::Util to improve introspection of hashes -) hash_value() - returns an integer hash value for a given string. -) bucket_info() - returns basic hash bucket utilization info -) bucket_stats() - returns more hash bucket utilization info -) bucket_array() - which keys are in which buckets in a hash More details on the new hash functions can be found below: Murmur Hash: (v3) from google, see http://code.google.com/p/smhasher/wiki/MurmurHash3 Superfast Hash: From Paul Hsieh. http://www.azillionmonkeys.com/qed/hash.html DJB2: a hash function from Daniel Bernstein http://www.cse.yorku.ca/~oz/hash.html SDBM: a hash function sdbm. http://www.cse.yorku.ca/~oz/hash.html SipHash: by Jean-Philippe Aumasson and Daniel J. Bernstein. https://www.131002.net/siphash/ They have all be converted into Perl's ugly macro format. I have not done any rigorous testing to make sure this conversion is correct. They seem to function as expected however. All of them use the random hash seed. You can force the use of a given function by defining one of PERL_HASH_FUNC_MURMUR PERL_HASH_FUNC_SUPERFAST PERL_HASH_FUNC_DJB2 PERL_HASH_FUNC_SDBM PERL_HASH_FUNC_ONE_AT_A_TIME Setting the environment variable PERL_HASH_SEED_DEBUG to 1 will make perl output the current seed (changed to hex) and the hash function it has been built with. Setting the environment variable PERL_HASH_SEED to a hex value will cause that value to be used at the seed. Any missing bits of the seed will be set to 0. The bits are filled in from left to right, not the traditional right to left so setting it to FE results in a seed value of "FE000000" not "000000FE". Note that we do the hash seed initialization in perl_construct(). Doing it via perl_alloc() (via init_tls) causes problems under threaded builds as the buffers used for reentrant srand48 functions are not allocated. See also the p5p mail "Hash improvements blocker: portable random code that doesnt depend on a functional interpreter", Message-ID: <CANgJU+X+wNayjsNOpKRqYHnEy_+B9UH_2irRA5O3ZmcYGAAZFQ@mail.gmail.com>
* [perl #115742] Push a new pad for recursive DB::DBFather Chrysostomos2012-11-151-1/+28
| | | | | | When invoking the debugger recursively, pp_dbstate needs to push a new pad (like pp_entersub) so that DB::DB doesn’t stomp on the lexical variables belonging to the outer call.
* Don’t crash with existent but undefined &DB::DBFather Chrysostomos2012-09-241-2/+11
| | | | | This is a follow-up to 432d4561c48, which fixed *DB::DB without &DB::DB, but not &DB::DB without body.
* don't crash with -d if DB::DB is seen but not defined [perl #114990]Jesse Luehrs2012-09-241-1/+12
|
* Refactor t/run/switcha.t to use test.pl instead of making TAP by hand.Colin Kuskie2012-09-201-3/+6
|
* [perl #105922] Allow any string before ->methFather Chrysostomos2012-09-201-1/+1
| | | | | | | | | | | | | | | | | | | The rules for filtering out what do not look like package names are not logical and disallow valid things like "::main", while allowing q"_#@*$!@*^(". This commit simply lets any non-empty string be used as a package name. If it is a typo, you’ll get an error anyway. This allows autobox-style calls like "3foo"->CORE::uc, or even "3foo"->uc if you set up @ISA first. I made an exception for the empty string because it messes up caches somehow and causes subsequent method calls all to be called on the main package. I haven’t looked into that yet. I don’t know whether it’s worth it. The changes to the tests in cpan/Test-Simple have been submit- ted upstream.
* t/run/mad.t: Avoid %ENV assignmentFather Chrysostomos2012-09-171-2/+2
| | | | I see no skip on VMS, so use an %ENV localisation that it supports.
* g++ + mad fails t/run/mad.tFather Chrysostomos2012-09-171-6/+6
| | | | | | | | | | | | | | | | | | | | For some reason, g++ causes $^X to have a relative path when called with one, whereas gcc causes it to have an absolute path: g++: $ ./perl -le 'print $^X' ./perl gcc: $ ./perl -le 'print $^X' /Users/sprout/Perl/perl.git-copy/perl (This is on 32-bit darwin.) This affects mad.t’s ability to find the current perl interpreter after a chdir.
* Refactor t/run/noswitch.t to use test.pl instead of making TAP by hand.Colin Kuskie2012-09-161-5/+9
|
* Refactor t/run/switchF.t to use test.pl instead of making TAP by hand.Colin Kuskie2012-09-161-3/+8
|
* Refactor t/run/switchn.t to use test.pl instead of making TAP by hand.Colin Kuskie2012-09-161-3/+7
|
* Refactor t/run/switch0.t to use test.pl instead of making TAP by hand.Colin Kuskie2012-09-141-2/+10
|
* "loading-file" and "loaded-file" DTrace probesShawn M Moore2012-08-282-1/+21
|
* "op-entry" DTrace probeShawn M Moore2012-08-281-2/+22
|
* ignore PERL_XMLDUMP when taintingTony Cook2012-08-081-0/+46
| | | | | | In theory this is a security issue, but from discussion on the security list that the system perl (or the perl used for anything critical) is wildly unlikely to have been built with -Dmad.
* fresh_perl.t: Skip #112312 tests on miniperlFather Chrysostomos2012-06-291-2/+2
| | | | They require attributes.pm.
* Test perl #112312, crash on syntax errorFather Chrysostomos2012-06-291-0/+52
| | | | | | | | | | | | | | | | I am having difficulty getting these tests to fail. They crash when run standalone, but always pass when run via fresh_perl.t. Hopefully, they will fail somewhere. :-) Yes, fresh_perl.t does begin with this: # ** DO NOT ADD ANY MORE TESTS HERE ** But t/comp/parser.t does not (and should not) use test.pl, so it is very hard to test something like this. Putting it here seemed slightly better than putting it in its own file.
* warn on -i with no input files given [perl #113410]Jesse Luehrs2012-06-261-1/+21
|
* Mostly complete fix for literal /(?{..})/ blocksDavid Mitchell2012-06-131-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the way that code blocks in patterns are parsed and executed, especially as regards lexical and scoping behaviour. (Note that this fix only applies to literal code blocks appearing within patterns: run-time patterns, and literals within qr//, are still done the old broken way for now). This change means that for literal /(?{..})/ and /(??{..})/: * the code block is now fully parsed in the same pass as the surrounding code, which means that the compiler no longer just does a simplistic count of balancing {} to find the limits of the code block; i.e. stuff like /(?{ $x = "{" })/ now works (in the same way that subscripts in double quoted strings always have: "$a{'{'}" ) * Error and warning messages will now appear to emanate from the main body rather than an re_eval; e.g. the output from #!/usr/bin/perl /(?{ warn "boo" })/ has changed from boo at (re_eval 1) line 1. to boo at /tmp/p line 2. * scope and closures now behave as you might expect; for example for my $x (qw(a b c)) { "" =~ /(?{ print $x })/ } now prints "abc" rather than "" * with recursion, it now finds the lexical within the appropriate depth of pad: this code now prints "012" rather than "000": sub recurse { my ($n) = @_; return if $n > 2; "" =~ /^(?{print $n})/; recurse($n+1); } recurse(0); * an earlier fix that stopped 'my' declarations within code blocks causing crashes, required the accumulating of two SAVECOMPPADs on the stack for each iteration of the code block; this is no longer needed; * UNITCHECK blocks within literal code blocks are now run as part of the main body of code (run-time code blocks still trigger an immediate call to the UNITCHECK block though) This is all achieved by building upon the efforts of the commits which led up to this; those altered the parser to parse literal code blocks directly, but up until now those code blocks were discarded by Perl_pmruntime and the block re-compiled using the original re_eval mechanism. As of this commit, for the non-qr and non-runtime variants, those code blocks are no longer thrown away. Instead: * the LISTOP generated by the parser, which contains all the code blocks plus OP_CONSTs that collectively make up the literal pattern, is now stored in a new field in PMOPs, called op_code_list. For example in /A(?{BLOCK})C/, the listop stored in op_code_list looks like LIST PUSHMARK CONST['A'] NULL/special (aka a DO block) BLOCK CONST['(?{BLOCK})'] CONST['B'] * each of the code blocks has its last op set to null and is individually run through the peephole optimiser, so each one becomes a little self-contained block of code, rather than a list of blocks that run into each other; * then in re_op_compile(), we concatenate the list of CONSTs to produce a string to be compiled, but at the same time we note any DO blocks and note the start and end positions of the corresponding CONST['(?{BLOCK})']; * (if the current regex engine isn't the built-in perl one, then we just throw away the code blocks and pass the concatenated string to the engine) * then during regex compilation, whenever we encounter a '(?{', we see if it matches the index of one of the pre-compiled blocks, and if so, we store a pointer to that block in an 'l' data slot, and use the end index to skip over the text of the code body. Conversely, if the index doesn't match, then we know that it's a run-time pattern and (for now), compile it in the old way. * During execution, when an EVAL op is encountered, if data->what is 'l', then we just use the pad that was in effect when the pattern was called; i.e. we use the current pad slot of the currently executing CV that the pattern is embedded within.
* make re_evals be seen by the toker/parserDavid Mitchell2012-06-131-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is a first step to making the handling of (/(?{...})/ more sane. But see the big proviso at the end. Currently a patten like /a(?{...})b/ is uninterpreted by the lexer and parser, and is instead passed as-is to the regex compiler, which is responsible for ensuring that the embedded perl code is extracted and compiled. The only thing the quoted string code in the lexer currently does is to skip nested matched {}'s, in order to get to end of the code block and restart looking for interpolated variables, \Q etc. This commit makes the lexer smarter. Consider the following pattern: /FOO(?{BLOCK})BAR$var/ This is currently tokenised as op_match ( op_const["FOO(?{BLOCK})BAR"] , $ "var" ) Instead, tokenise it as: op_match ( op_const["FOO"] , DO { BLOCK ; } , op_const["(?{BLOCK})"] , op_const["BAR"] , $ "var" ) This means that BLOCK is itself tokenised and parsed. We also insert a const into the stream to include the original source text of BLOCK so that it's available for stringifying qr's etc. Note that by allowing the lexer/parser direct access to BLOCK, we can now handle things like /(?{"{"})/ This mechanism is similar to the way something like "abc $a[foo(q(]))] def" is currently parsed: the double-quoted string handler in the lexer stops at $a[, the 'foo(q(]))' is treated as perl code, then at the end control is passed back to the string handler to handle the ' def'. This commit includes a new error message: Sequence (?{...}) not terminated with ')' since when control is passed back to the quoted-string handler, it expects to find the ')' as the next char. This new error mostly replaces the old Sequence (?{...}) not terminated or not {}-balanced in regex Big proviso: This commit updates toke.c to recognise the embedded code, but doesn't then do anything with it. The parser will pass both a compiled do block and a const for each embedded (?{..}), and Perl_pmruntime just throws away the do block and keeps the constant text instead which is passed to the regex compiler. So currently each code block gets compiled twice (!) with two sets of warnings etc. The next stage will be to pass these do blocks to the regex compiler. This commit is based on a patch I had originally worked up about 6 years ago and has been sitting bit-rotting ever since.
* Improve the tests for -xNicholas Clark2012-02-273-2/+21
| | | | | Test the error message generated when -x can't find a "#!perl" line. Test that this error message still appears when -x is used with -e.
* Improve the tests for the -n and -p switches.Nicholas Clark2012-02-272-4/+17
| | | | | | Verify that -p actually runs the code in the program body. Verify that -n doesn't implicitly print out the contents of $_. For both, verify that an END block runs after the implicit loop.
* Simplify platform specific code in t/run/cloexec.tNicholas Clark2012-02-271-6/+3
| | | | | | | | | | | | | Don't assign to two lexical variables, $Is_VMS and $Is_Win32, only to use them immediately for the same purpose - to skip the entire test. In turn, there's no need to conditionally set $quote to a value suitable for VMS or Win32, when neither OS ever runs the test. The code has been this way since the file was added by commit 742218b34f58f961 in Nov 2006. Hence I don't think that the vestigial $quote logic corresponds to pre-commit version that did run on these platforms. Instead I infer that it has come from t/op/exec.t, used as a template for running sub-scripts in a portable fashion.
* Test ‘Too late for -[Mm]’Father Chrysostomos2011-12-301-1/+5
|
* [perl #104288] Die with ‘Unrecognized switch’ on #! lineFather Chrysostomos2011-12-301-1/+15
| | | | | | | | | | | | | | | | | If a switch such as -x that cannot occur on the shebang line is used there, perl dies with ‘Can’t emulate...’. If an unrecognised switch is used on the command line, perl dies with ‘Unrecognized switch...’. It just happens to use the former error message for unrecognized switches on the shebang line, which can be confusing: $ perl -e '#!perl -G' Can't emulate -G on #! line at -e line 1. This commit changes it to output the same message as command-line switches for those that are unrecognised wherever they are used.
* test that version.pm does not clobber localeRicardo Signes2011-12-181-1/+31
|