### SPAR ### 34 755 1154536064 1224957725 makepp_test_script.pl # # This if a multiple hack. First we steal the contents of another test, because # we want to test the same things, only invoked from the command line. Then we # call makepp to tell us what it would have done, so we can inherit any future # changes as well. Then we call makeppbuiltin once, and perform everything # internally, so that we don't have to fork exec perl many times. This is not # how makeppbuiltin usually works, but builtins within a rule do. # # Slurp this test into our directory. open DATA, "$Mpp::source_path/builtins.test" or die "can't find builtins.test near here--$!\n"; eval { un_spar() }; # makepp --dry-run barfs at rules treating plain file as dir. rename dir2 => 'tempdir2'; mkdir 'dir2'; # Ask politely what we need to do. { open my $fh, '>&STDOUT'; open STDOUT, '>commands'; makepp '--dry-run'; open STDOUT, '>&', $fh; close $fh; } # Restore the way it was in builtins.test. rmdir 'dir2'; rename 'tempdir2' => dir2; # We don't start a real command, just use this to get our code loaded # within the context of makeppbuiltin. makepp \'builtin', '-I.', '-Mworker', 'clonetest'; ### 42 644 1153861432 1473530808 worker.pm # Normally from the command line the commands can inherit nothing from the # context of their makefile (since there is none). But here we rerun tests # that do have such a context, so get it from the makefile. open my $mf, 'RootMakeppfile' or die $!; while( <$mf> ) { print, eval if /^sub / or s/^perl /eval / or s/^(\w+) *= *(.*)/our \$$1 = '$2'/; } # pseudocommand which in fact runs all the others sub c_clonetest { open my $fh, 'commands'; while( <$fh> ) { next if ord != ord '&'; warn $_; chop; my $comment = Mpp::Text::find_unquoted $_, '#'; $_ = substr $_, 0, $comment if $comment > -1; $0 = 'makeppbuiltin'; @ARGV = Mpp::Text::unquote_split_on_whitespace $_; substr( $ARGV[0], 0, 1 ) = ''; # Remove & eval { Mpp::doit }; warn $@ if $@; } # We don't know how many files we created, but just to satisfy the test harness: Mpp::Cmds::c_sed 's/(\d+) (\d+) (\d+)/N_FILES\01$1\01$2\01$3\01/', 'answers/n_files', '-o', '.makepp/log'; # Now do as makeppbuiltin does with --help. @ARGV = '--help'; open STDERR, '>help'; for $0 ( sort grep { /^c_/ and defined &{"Mpp::Cmds::$_"} } keys %Mpp::Cmds:: ) { eval { Mpp::doit }; warn "\n"; } close STDERR; unlink 'answers/help' if 'a' lt 'A'; # Ebcdic does it the other way round, failing on -i/-I } 1; ### D 755 1140344139 1140344139 answers ### 176 644 1153678523 1402433959 answers/help cat options: -f, --force -i, --inpipe=arg -I, --infail -o, --output=arg -O, --outfail -S, --sync-lines -v, --verbose chmod options: -v, --verbose cp options: -f, --force -l, --link -s, --symbolic-link -v, --verbose cut options: -c, --characters=arg -d, --delimiter=arg -E, --no-escape -f, --fields=arg --force -i, --inpipe=arg -I, --infail -l, --lines=arg -m, --matching -o, --output=arg -O, --outfail -p, --printf=arg -r, --record-size=arg -s, --only-delimited --separator=arg -S, --sync-lines -v, --verbose echo options: -E, --no-escape -f, --force -n, --no-newline -o, --output=arg -O, --outfail -v, --verbose expr options: -f, --force -n, --no-newline -o, --output=arg -O, --outfail -v, --verbose grep options: -c, --count -f, --force -i, --inpipe=arg -I, --infail -l, --list, --files-with-matches -o, --output=arg -O, --outfail -r, --record-size=arg -s, --separator=arg -S, --sync-lines -v, --vice-versa, --revert-match --verbose -w, --waste-file=arg install options: -c, --copy -d, --directory -g, --group=arg -l, --link --logfile=arg -m, --mode=arg -o, --owner=arg -r, --resolve-symbolic-link -s, --strip -S, --symbolic-link -v, --verbose ln options: -f, --force -r, --resolve-symbolic-link -s, --symbolic-link -v, --verbose mkdir options: -f, --force -m, --mode=arg -p, --parent -v, --verbose mv options: -f, --force -v, --verbose perl options: -f, --force -i, --inpipe=arg -I, --infail -o, --output=arg -O, --outfail -r, --record-size=arg -s, --separator=arg -S, --sync-lines -v, --verbose preprocess options: -a, --assignment -f, --force -h, --hashref=arg -o, --output=arg -O, --outfail -S, --sync-lines -v, --verbose printf options: -E, --no-escape -f, --force -o, --output=arg -O, --outfail -v, --verbose rm options: -f, --force -m, --metainfo -v, --verbose sed options: -f, --force -i, --inpipe=arg -I, --infail -o, --output=arg -O, --outfail -r, --record-size=arg -s, --separator=arg -S, --sync-lines -v, --verbose sort options: -c, --compare=arg -d, --detransform=arg -f, --force -i, --inpipe=arg -I, --infail -n, --numeric-sort -o, --output=arg -O, --outfail -r, --reverse --record-size=arg -s, --separator=arg -t, --transform=arg -u, --unique -v, --verbose template options: -d, --defined -f, --force -h, --hashref=arg -i, --inpipe=arg -I, --infail -m, --multiline=arg -o, --output=arg -O, --outfail -r, --record-size=arg -s, --simple=arg --separator=arg -S, --sync-lines -v, --verbose touch options: -v, --verbose uninstall options: -i, --inpipe=arg -I, --infail -v, --verbose uniq options: -c, --compare=arg -f, --force -i, --inpipe=arg -I, --infail -o, --output=arg -O, --outfail -r, --record-size=arg -s, --separator=arg -S, --sync-lines -v, --verbose yes options: -E, --no-escape -f, --force -n, --no-newline -o, --output=arg -O, --outfail -v, --verbose