How to send command line options into test scripts?

Y

yusuf

Hi,

Does anyone know how to send command line options into test scripts
from prove?

For instance, I want to call the test file "t" with the options:

--log somefile --output=true

but I can't seem to find out how to do it from prove. I tried using the
$Test::Harness::switches var, but that does not seem to do it.

I didn't post any code because this is not a code question.
 
M

Matt Garrish

yusuf said:
Does anyone know how to send command line options into test scripts
from prove?
I didn't post any code because this is not a code question.

Then it's not a question to post to a perl coding group, is it?

Matt
 
Y

yusuf

Then it's not a question to post to a perl coding group, is it?

But its a perl question right? Which group should it go to?
 
M

Matt Garrish

yusuf wrote:
[context restored]
But its a perl question right? Which group should it go to?

It's no more relevant than asking how ppm works. I suspect there's a
Perl question you're trying to ask, but since you refuse outright to
post any code (or even give an explanation of what you're doing) I
doubt you'll find anyone inclined to help you get to it.

Why out of curiosity would you post one vague snippet of code and then
claim it's not a code question?

Matt
 
D

DJ Stunks

yusuf said:
Hi,

Does anyone know how to send command line options into test scripts
from prove?

For instance, I want to call the test file "t" with the options:

--log somefile --output=true

but I can't seem to find out how to do it from prove. I tried using the
$Test::Harness::switches var, but that does not seem to do it.

I didn't post any code because this is not a code question.

Perl does not exist independent of code; Perl IS code.

-jp

PS - There is no spoon.
 
Y

yusuf

Why out of curiosity would you post one vague snippet of code and then
claim it's not a code question?

I didn't post any code. They were command line argument examples. I
can't post any code because I don't know how to code the thing I need.
The thing I need is to:

- From 'prove' which uses Test::Harness, when I call the different test
files in runtests(). How do I send in command line arguments to those
test files.
 
M

Matt Garrish

yusuf said:
I didn't post any code.

Then explain "I tried using the $Test::Harness::switches var".

Switches, if you read the documentation, is for setting the
command-line switches for perl.
They were command line argument examples. I
can't post any code because I don't know how to code the thing I need.
The thing I need is to:

- From 'prove' which uses Test::Harness, when I call the different test
files in runtests(). How do I send in command line arguments to those
test files.

Well, if you've read the documentation you know it's not when you call
prove, because prove just runs your tests. Why is your test data not
self-contained in the test file? Do you know why you're using this
approach and not the debugger? I'm beginning to have my doubts.

Matt
 
Y

yusuf

Well, if you've read the documentation you know it's not when you call
prove, because prove just runs your tests. Why is your test data not
self-contained in the test file? Do you know why you're using this
approach and not the debugger? I'm beginning to have my doubts.

I can't use preconfigured tests because the tests have to run against
running baseline and candidate processes. So the controller script will
start the baseline and candidate process and then it needs to send in
the process id of each to the test scripts.

I am not using the Test module to test perl class files, but against my
own executables.
 
M

Mumia W.

[...]
I am not using the Test module to test perl class files, but against my
own executables.

Then create stub scripts that supply the correct parameters.
 
Y

yusuf

Then create stub scripts that supply the correct parameters.

But wouldn't the stub scripts have to still be called by runtests()?
The whole issue is how to call the test files from runtests(), and
still pass in parameters. Even if I have stub scripts how will I send
in the parameters to the stub scripts, because the pid being sent in
will survive over multiple tests.
 
Y

yusuf

Since people love code so much, here is an example of what I would like
to happen (if it did not error out):

test.pl:

#!/usr/bin/perl



use strict;
use warnings;



use Test::Harness;



my @a = ('t -x HELLO');



runtests(@a);

t:
#!/usr/bin/perl



use strict;
use warnings;



use Test::More tests => 1;



use Getopt::Std;



my %opts;



getopts('x:',\%opts);



print "X";
print $opts{x};



ok(1);
 
M

Mumia W.

But wouldn't the stub scripts have to still be called by runtests()?
The whole issue is how to call the test files from runtests(), and
still pass in parameters. Even if I have stub scripts how will I send
in the parameters to the stub scripts, because the pid being sent in
will survive over multiple tests.

The stub scripts contain the parameters needed by the
executable you're testing. Each stub script will contain
/different/ parameters.

And please don't snip attributions.
 
M

Matt Garrish

yusuf said:
Since people love code so much, here is an example of what I would like
to happen (if it did not error out):

And here I was thinking you were an obnoxious prick at the beginning of
the thread. Way to up the ante.

Matt
 
Y

yusuf

And here I was thinking you were an obnoxious prick at the beginning of
the thread. Way to up the ante.

What the heck is your problem? I have been providing everything that
people requested. Instead of help, I've gotten stupid comments. If you
don't want to help just shut up and move along.
 
M

Matt Garrish

yusuf said:
If you don't want to help just shut up and move along.

Why, this isn't your personal help desk?

Best of luck finding the help the world owes you, though.

Matt
 
Y

yusuf

It is a response to _your_ rudeness.

Well, it wasn't my intention to be rude. Sorry if you felt that way.
 
K

Keith Keller

Well, it wasn't my intention to be rude. Sorry if you felt that way.

If it wasn't your intention to be rude, you might consider reading
and following the Posting Guidelines that are posted periodically
to the newsgroup.

--keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top