Problem with 'sed' on one Windows bot?

A test I added in r317607 is passing almost everywhere, except for
llvm-clang-x86_64-expensive-checks-win. Other Windows bots are happy.

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/6013

The test runs 'sed' on a file to generate variations of the input
assembler source for Linux and Darwin. I have to say it looks like
'sed' is being the problem on that one bot. I reverted the test
because "don't argue with the bots" but... but... "It's not my fault!"

If anybody has any insight it would be greatly appreciated.
Thanks,
--paulr

The failure is this:

Command Output (stdout):

"Robinson, Paul via llvm-dev" <llvm-dev@lists.llvm.org> writes:

A test I added in r317607 is passing almost everywhere, except for
llvm-clang-x86_64-expensive-checks-win. Other Windows bots are happy.

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/6013

The test runs 'sed' on a file to generate variations of the input
assembler source for Linux and Darwin. I have to say it looks like
'sed' is being the problem on that one bot. I reverted the test
because "don't argue with the bots" but... but... "It's not my fault!"

If anybody has any insight it would be greatly appreciated.
Thanks,
--paulr

The failure is this:

Command Output (stdout):
--
$ "sed" "-E" "s/@ELF@(.*)/\1/;s/@MACHO@(.*)//" "C:\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win\llvm\test\DebugInfo\X86\dwarfdump-header-64.s"

Looks to me like the the \1 is being interpreted as an escape and you're
getting a literal "1" instead of the substitution. Given that there are
double-quotes here that sort of makes sense, though the commit clearly
used single quotes, so that's odd. Maybe there's something funny about
how lit is passing this to whatever shell?

In any case, presumably `sed -e 's/@ELF@//; s/@MACHO@(.*)//'` would work
around that - since you're capturing the rest of the line you don't
really need the backreference anyway.

The short answer is that Galina should install the correct version of
`sed` (presumably from gnuwin32) on that bot.
The somewhat longer answer is that you could work around as Justin
suggested, but I'm not sure what's your sed foo and/or whether it's
worth going that route.

Side note: in my early days on Windows years ago I spent a good couple
of hours trying to figure out why some tests were failing, to discover
I had installed the wrong tool.
I don't recall whether the documentation points to the one true
version of sed/awk/* required, but in case it doesn't, maybe we might
consider adding it?

As Davide suggests, most likely it's a bot software installation snafu.
But the simpler sed script works perfectly, and I'll do that for now.

I had understood that LLVM expected people to install GnuWin32, but
maybe it's not sufficiently well specified about versions and whatnot.
--paulr

There is nothing wrong with the bot.

sed --version
sed (GNU sed) 4.2.2

It works just fine when I run the exact command in question manually from the shell.

As Justin has suggested, the problem lies somewhere in LIT in how it processes the arguments from input file to a shell execution.

Thanks

Galina

Thanks, Galina. It doesn’t explain why the test worked on some bots but not this one, but Justin’s workaround is okay with me.

–paulr

The reason might be in different versions of Windows and shells.

Could you point to a particular bot the test worked on, please?

Galina

I believe it passed on clang-x64-ninja-win7 and clang-x86-windows-msvc2015.

Thanks,

–paulr