Commit graph

346 commits

Author SHA1 Message Date
Avery Pennarun
34ce233f5e Rename 111-compile to 111-compile2.
Not a great name, but make it obvious that this is a slightly different test
from 110-compile.
2012-02-09 00:42:40 -05:00
Avery Pennarun
1f304f4d1d t/100-args: add a test for --old-args feature. 2012-02-09 00:42:40 -05:00
Avery Pennarun
a8bec74449 t/350-deps: 'redo clean' was crashing. 2012-02-08 22:56:04 -05:00
Avery Pennarun
c38e2bee92 t/201-fail: add a simple test for non-existent source files.
(This actually went uncaught in my redo rewrite.  Oops.)
2012-02-08 22:51:04 -05:00
Avery Pennarun
7822f5a5bb t/*: rearrange tests into numbered directories.
It was getting way too ad-hoc in there.  Let's reorganize the tests so that
there's a good, obvious, suggested sequence to run them in.
2012-02-08 01:56:50 -05:00
Avery Pennarun
116c279e96 t/*: update some tests from my rewrite branch.
Just some minor test fixes so that tests pass on both current redo and the
upcoming rewritten one.
2012-02-08 01:56:43 -05:00
Avery Pennarun
21f88094d5 Change definitions of $1,$2,$3 to match djb's redo.
If you use "redo --old-args", it will switch back to the old
(apenwarr-style) arguments for now, to give you time to update your .do
scripts.  This option will go away eventually.

Note: minimal/do doesn't understand the --old-args option.  If you're using
minimal/do in your project, keep using the old one until you update your use
of $1/$2, and then update to the new one.

apenwarr-style default.o.do:
   $1      foo
   $2      .o
   $3      whatever.tmp

djb-style default.o.do:
   $1      foo.o
   $2      foo
   $3      whatever.tmp

apenwarr-style foo.o.do:
   $1      foo.o
   $2      ""
   $3      whatever.tmp

djb-style foo.o.do:
   $1      foo.o
   $2      foo.o  (I think?)
   $3      whatever.tmp
2011-12-31 02:49:39 -05:00
Avery Pennarun
0670f78b96 md-to-man.do: suggest how to install markdown/BeautifulSoup
...since they aren't included by default on MacOS X, but easy_install can
easily get them for you.
2011-12-31 02:49:39 -05:00
Avery Pennarun
75c3a0a46b Import latest options.py from bup. 2011-12-31 02:49:39 -05:00
Avery Pennarun
20951f9e6e t/pytest.do: don't run in minimal/do.
And add a reminder to test.do to run 'minimal/do test'.
2011-12-31 02:49:39 -05:00
Avery Pennarun
656c3c583c Docs: recommend adding redo-ifchange with a lot of targets at a time.
Some people don't know to do this, and their scripts are unnecessarily slow
because of it.
2011-05-08 04:25:51 -04:00
Avery Pennarun
2fa8aab191 redo-sh: reverse a case that caused 'set -e' to abort on zsh.
Correctly, I might add.  It's too bad none of my other shells did it.  Sigh.
2011-05-08 01:25:26 -04:00
Avery Pennarun
c6020cf1cd t/shelltest.od: quiet some error messages that get printed during testing.
If the error message only triggered a shelltest warning instead of a
failure, then they're harmless, so we might as well silence them when
running 'redo test' (which runs t/shelltest.do, which enables
SHELLTEST_QUIET).  We still want to print them when actually testing out
shelltest.od, though, to help with debugging the script.
2011-05-08 01:25:20 -04:00
Avery Pennarun
4e285607f0 Don't use "insert ... default values" in sqlite3.
It isn't supported in older sqlite3 versions.  Let's just do something
equivalent instead.
2011-05-07 23:47:03 -04:00
Avery Pennarun
b993e449f8 shelltest: use a more magical magic number for success.
There may be some odd situation where a shell returns 0 despite not executing
the script correctly; now 0 is an error condition.
2011-04-17 23:39:53 -04:00
Avery Pennarun
e9e24bb450 t/shelltest.od: another test for ${x#y} behaviour.
If y contains a * character, it's a case-esac style wildcard unless it's in
"" or '', which tells it to match a literal *.  But in dash/busybox, the ''
quoting doesn't actually work, only "" does.

Since there's a workaround - just always use "" quoting - it's not that
fatal.  If the "" quoting doesn't work, then we'll make it fail.
2011-04-02 16:30:14 -07:00
Avery Pennarun
03763177ff shelltest.od: a few more/better tests and clarification comments. 2011-04-02 15:41:52 -07:00
Avery Pennarun
3b940696c1 redo-sh.do: prettier log messages.
Make it easier to see which shells fail/warn about what.
2011-04-02 15:33:13 -07:00
Avery Pennarun
92c3e7c5af Test for previous override fix. 2011-03-30 23:35:20 -04:00
Avery Pennarun
0a5f424ef8 User-overridden targets stay overridden even if the last build failed.
Previously, if 'redo-ifchange foo' failed last time, then creating foo
manually wouldn't help; 'redo-ifchange foo' would still try to rebuild it.
But if the first run *did* create it, then manually overriding it *did*
work.

That inconsistency is pointless.  If the user creates it by hand, it doesn't
matter if it failed to build last time or not; the user wants it overridden.
So this way, something that can't build can at least be manually created as
a hack.
2011-03-30 23:35:20 -04:00
Avery Pennarun
fb20652d04 Test for precenting state.relpath fix. 2011-03-27 15:25:11 -04:00
Avery Pennarun
705722d612 state.relpath: correct broken paths ending with /, etc.
Bug reported by Elliott Hird.  Based on a patch by Tim Allen, but I didn't
do it the same way.
2011-03-27 15:25:11 -04:00
Avery Pennarun
49228ce01c Add a test for the preceding fix (nonexistent directories). 2011-03-22 23:02:12 -07:00
Avery Pennarun
2efbbc26b9 Don't crash on targets in directories that don't exist yet.
The reason we'd crash is that we tried to pre-create a file called
$target.redo.tmp, which wouldn't work because the directory containing
$target didn't exist.

We now try to generate a smarter filename by using the innermost directory
of target that *does* exist.  It's a little messy, but the idea is to make
sure we won't have to rename() across a filesystem boundary if, for example,
there's a mounted filesystem in the middle of the hierarchy somewhere.
2011-03-22 23:00:34 -07:00
Avery Pennarun
07af5d83f9 redo: only default to 'all' in the toplevel instance of redo.
We already did this in minimal/do, and redo-ifchange already did this, but
plain redo didn't.  This made constructs like:

	for d in *.x; do
		echo "${d%.x}"
	done | xargs redo

dangerous, because if there were no matching files, we'd try to 'redo all'.
2011-03-10 21:10:15 -08:00
Avery Pennarun
2260bdd30f md2man: fix compatibility problem with python-markdown 1.6.
Symptom: the following error message when building redo.1:

	ValueError: non-man-compatible html tag u'br'
2011-03-10 19:49:18 -08:00
Avery Pennarun
d26ec22d88 Test for previous atime/ctime fix. 2011-03-10 14:37:07 -08:00
Avery Pennarun
4bf569c2a4 builder.py: detect overrides by only ctime, not all of struct stat.
We were accidentally including things like the atime in the comparison,
which is obviously silly; someone reading the file shouldn't mark it as a
manual override.
2011-03-10 14:36:45 -08:00
Avery Pennarun
d5e6951111 t/curse/Makefile: delete.
I don't remember why it was there, but we clearly don't use it anymore.
2011-03-10 14:36:45 -08:00
Avery Pennarun
989eb6804b minimal/do: fix a typo: DO_BUILD -> DO_BUILT
...and remove the "disable-if-minimal-do" from the test that would have
caught this bug.

Reported by Ulrik Sverdrup.
2011-03-06 21:38:34 -08:00
Avery Pennarun
164e213582 Test for previous PREFIX fix to minimal/do. 2011-03-05 19:03:34 -08:00
Avery Pennarun
0e037b8c45 minimal/do: leak fewer variables, especially PREFIX.
Since we use ". filename.do" to run the .do files instead of just
"filename.do", shell local variables end up being inherited by the
subprogram.  Change all the local variables to be all lowercase, to avoid
conflicting with any typical environment variables someone might use.

The particular variable that triggered this was PREFIX (reported by "ulrik"
on the mailing list) and that fixes this, at least.

Arguably we shouldn't be using ".", but using it avoids unnecessary forks,
which is kind of nice.
2011-03-05 19:03:34 -08:00
Avery Pennarun
c1a1f32445 MacOS: "-e filename/." returns true even for non-directories.
This has something to do with resource forks.  So use "-d filename/."
instead, which returns false if filename is not a directory.
2011-03-05 19:03:30 -08:00
Avery Pennarun
97eea66830 redo-sh.do: add 'posh' as another possible shell.
It fails, but who knows, maybe someday it won't.
2011-02-28 22:11:28 -08:00
Avery Pennarun
ee32a965d8 shelltest.od: test that $1/$2/$3 are set correctly in "." scripts.
dash seems to fail this one, and it's not pretty.
2011-02-28 22:07:21 -08:00
Avery Pennarun
32f584cb1c shelltest: detect the ". of empty script" shell problem. 2011-02-28 22:06:57 -08:00
Avery Pennarun
1ed168e79e minimal/do: work around a bug with empty .do files.
If you ". ./filename" and ./filename contains no commands, apparently
ash/dash will give the exit code of the command *before* the ., rather than
defaulting to zero as it supposedly should.  This should work around it in
our .do files at least.

Reported by Tim Allen.
2011-02-28 21:13:55 -08:00
Avery Pennarun
2dde4dbced redo-sh: on Solaris, try /usr/xpg4/bin/sh for a POSIX shell.
Suggested by someone on news.ycombinator.
2011-02-28 05:45:20 -08:00
Avery Pennarun
cfc3f44d64 minimal/do: 'redo-ifchange' with no parameters shouldn't try to build all.
It should just build nothing.  Because sometimes you want to do something
like:
	redo-ifchange $(find -name '*.c')

And the find doesn't return any results.  This is consistent with what real
redo does.

Added a test to confirm that it works.
2011-02-26 18:01:31 -08:00
Avery Pennarun
94c254de77 Rename flush-cache.py to flush-cache, and rearrange the code a bit.
It was working fine, but the style wasn't exactly the way I like it, because
I'm unnecessarily picky. :)

Also, removed the file extension since we should probably learn from the
fact that it's already been rewritten once from one language to another.
Who knows, maybe it will be again someday.
2011-02-23 01:27:41 -08:00
Joseph Garvin
d039aad57b Fix tests when the sqlite3 command line utility isn't installed.
We know the user already has to have python, so use its bindings.
2011-02-23 01:22:04 -08:00
Joseph Garvin
e8790145be Use /usr/bin/env to detect python location
...in case it's installed in a nonstandard location.
2011-02-23 01:21:27 -08:00
Avery Pennarun
0a14db937c README.md: mention the mailing list nearer to the top. 2011-02-22 02:16:37 -08:00
Avery Pennarun
2ef9d69b7b README.md: typo fix for my previous fix. 2011-02-21 15:02:22 -08:00
Avery Pennarun
0ce949fb81 README: a bunch of improvements to answer recent questions.
Inspired by some questions send to me in private email.
2011-02-21 05:11:59 -08:00
Avery Pennarun
a2bce72255 Simplify autodependency examples.
Turns out we don't need sed to process the output of gcc -MD.  We can just
do this:

	read DEPS <filename.deps

The 'read' command in sh actually handles backslashes correctly, so we don't
have to sed them out after all.  And then a simple ${DEPS#*:} removes the
"target:" prefix from the dependency line, and we're done!
2011-02-21 04:00:53 -08:00
Avery Pennarun
ea7057d9b6 redo-ifchange: remove special case for zero arguments.
Not sure why I put there, but special cases aren't worth the hassle.
2011-02-21 03:55:18 -08:00
Avery Pennarun
60b34d81ec vars.do: an improvement on the previous patch.
It would still loop infinitely if a string was "master " (trailing space).
2011-02-17 01:05:52 -08:00
Henry Gebhardt
6508cc0a63 version/vars.do: avoid infinite loop if the tag string is " master"
(ie. with an extra space)
2011-02-15 15:12:53 -08:00
Tim Allen
e27aaf01e7 Make redo read byte-strings from the database.
By default, the database redo uses to store file state returns filenames
as Unicode strings, and if redo tries to run a build-script whose
fully-qualified path contains non-ASCII characters then redo crashes
when trying to promote the path to a Unicode string.

This patch ensures that the database always returns byte-strings, not
Unicode strings. That way, the fully-qualified path and the target name
are both byte-strings and can be joined without issue.

(Fixes a bug reported by Zoran Zaric.)
2011-02-14 18:48:33 -08:00