summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-09-20 11:01:44 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-09-20 15:38:02 +0200
commitaeee571501df4d3b1d91e10d61b434f0ecac4d6a (patch)
tree09c1339165b805c05bff1fe8dec10bb369c03af2
parent89d911a2775118dbf5e4cd337e4ede4284b6f717 (diff)
Use tempfile instead of stdin in exectest.pl
...so it can easily be reused to test unoidl-write, too. Change-Id: I4992850b44faaa152bcf1d281f2787824d6ad036
-rw-r--r--idlc/CustomTarget_parser_test.mk44
-rw-r--r--solenv/bin/exectest.pl52
2 files changed, 55 insertions, 41 deletions
diff --git a/idlc/CustomTarget_parser_test.mk b/idlc/CustomTarget_parser_test.mk
index 6be490aed38b..d8defd6fe5d6 100644
--- a/idlc/CustomTarget_parser_test.mk
+++ b/idlc/CustomTarget_parser_test.mk
@@ -23,57 +23,59 @@ $(call gb_CustomTarget_get_target,idlc/parser_test) : \
$(SRCDIR)/idlc/test/parser/polystruct.tests \
$(SRCDIR)/idlc/test/parser/published.tests \
$(SRCDIR)/idlc/test/parser/struct.tests \
- $(SRCDIR)/idlc/test/parser/typedef.tests
+ $(SRCDIR)/idlc/test/parser/typedef.tests \
+ | $(call gb_CustomTarget_get_workdir,idlc/parser_test)/.dir
$(call gb_Helper_abbreviate_dirs,( \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/attribute.tests \
+ $(call gb_CustomTarget_get_workdir,idlc/parser_test)/in.idl \
$(call gb_Executable_get_command,idlc) \
- -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) \
- -stdin && \
+ -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) {} && \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/constant.tests \
+ $(call gb_CustomTarget_get_workdir,idlc/parser_test)/in.idl \
$(call gb_Executable_get_command,idlc) \
- -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) \
- -stdin && \
+ -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) {} && \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/constructor.tests \
+ $(call gb_CustomTarget_get_workdir,idlc/parser_test)/in.idl \
$(call gb_Executable_get_command,idlc) \
- -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) \
- -stdin && \
+ -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) {} && \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/interfaceinheritance.tests \
+ $(call gb_CustomTarget_get_workdir,idlc/parser_test)/in.idl \
$(call gb_Executable_get_command,idlc) \
- -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) \
- -stdin && \
+ -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) {} && \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/methodoverload.tests \
+ $(call gb_CustomTarget_get_workdir,idlc/parser_test)/in.idl \
$(call gb_Executable_get_command,idlc) \
- -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) \
- -stdin && \
+ -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) {} && \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/oldstyle.tests \
+ $(call gb_CustomTarget_get_workdir,idlc/parser_test)/in.idl \
$(call gb_Executable_get_command,idlc) \
- -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) \
- -stdin && \
+ -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) {} && \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/polystruct.tests \
+ $(call gb_CustomTarget_get_workdir,idlc/parser_test)/in.idl \
$(call gb_Executable_get_command,idlc) \
- -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) \
- -stdin && \
+ -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) {} && \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/published.tests \
+ $(call gb_CustomTarget_get_workdir,idlc/parser_test)/in.idl \
$(call gb_Executable_get_command,idlc) \
- -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) \
- -stdin && \
+ -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) {} && \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/struct.tests \
+ $(call gb_CustomTarget_get_workdir,idlc/parser_test)/in.idl \
$(call gb_Executable_get_command,idlc) \
- -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) \
- -stdin && \
+ -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) {} && \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/typedef.tests \
+ $(call gb_CustomTarget_get_workdir,idlc/parser_test)/in.idl \
$(call gb_Executable_get_command,idlc) \
- -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) \
- -stdin) > $@.log 2>&1 || (cat $@.log && false))
+ -O $(call gb_CustomTarget_get_workdir,idlc/parser_test) {}) \
+ > ${}.log 2>&1 || (cat ${}.log && false))
# vim: set noet sw=4 ts=4:
diff --git a/solenv/bin/exectest.pl b/solenv/bin/exectest.pl
index 2cd9fb6e1be8..bd9b5f373cdc 100644
--- a/solenv/bin/exectest.pl
+++ b/solenv/bin/exectest.pl
@@ -23,8 +23,11 @@ sub encode($)
return $arg
}
-$#ARGV >= 1 or die "Usage: $0 <input file> <command> <arguments...>";
-open INPUT, $ARGV[0] or die "cannot open $ARGV[0]: $!";
+$#ARGV >= 2
+ or die "Usage: $0 <input file> <temp file> <command> <arguments...>";
+open INPUT, '<', $ARGV[0] or die "cannot open $ARGV[0]: $!";
+shift @ARGV;
+$temp = $ARGV[0];
shift @ARGV;
$failed = 0;
$open = 0;
@@ -35,7 +38,31 @@ while (1) {
{
if ($open)
{
- close PIPE;
+ close OUTPUT;
+ my $prog = '';
+ my $assigns = 1;
+ for ($i = 0; $i != scalar(@ARGV); ++$i)
+ {
+ $prog .= ' ' unless $i == 0;
+ if ($assigns && $ARGV[$i] =~ /^([A-Za-z_][A-Za-z0-9_]+)=(.*)$/)
+ {
+ $prog .= $1 . "='" . encode($2) . "'";
+ }
+ else
+ {
+ if ($ARGV[$i] =~ /^{}$/)
+ {
+ $prog .= "'" . encode($temp) . "'";
+ }
+ else
+ {
+ $prog .= "'" . encode($ARGV[$i]) . "'";
+ }
+ $assigns = 0;
+ }
+ }
+ system("$prog");
+ unlink $temp;
if ($? % 256 == 0)
{
$exit = $? / 256;
@@ -60,27 +87,12 @@ while (1) {
last if $eof;
$expect = $1;
$title = $2;
- my $prog = '';
- my $assigns = 1;
- for ($i = 0; $i != scalar(@ARGV); ++$i)
- {
- $prog .= ' ' unless $i == 0;
- if ($assigns && $ARGV[$i] =~ /^([A-Za-z_][A-Za-z0-9_]+)=(.*)$/)
- {
- $prog .= $1 . "='" . encode($2) . "'";
- }
- else
- {
- $prog .= "'" . encode($ARGV[$i]) . "'";
- $assigns = 0;
- }
- }
- open PIPE, "| $prog" or die "cannot start process: $!";
+ open OUTPUT, '>', $temp or die "cannot open $temp: $!";
$open = 1;
}
elsif ($open)
{
- print PIPE $in or die "cannot write to pipe: $!";
+ print OUTPUT $in or die "cannot write to $temp: $!";
}
}
exit(0);