Will the Expect suit to me? ( maybe NOT a wrong post ) - Unix

This is a discussion on Will the Expect suit to me? ( maybe NOT a wrong post ) - Unix ; Is this a right group to ask question about Expect programming? I search the Usenet and have not found a group something like comp.....expect. And, my qeustion is below. I am writing a Linux program which will talk to its ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Will the Expect suit to me? ( maybe NOT a wrong post )

  1. Will the Expect suit to me? ( maybe NOT a wrong post )

    Is this a right group to ask question about Expect programming? I
    search the Usenet and have not found a group something like
    comp.....expect. And, my qeustion is below.

    I am writing a Linux program which will talk to its stdin/stdout with
    two kind of information:
    1, human readable strings ( send/receive )
    2, non-human-readable raw data ( send/receive )

    And, while the program is running and talking to the stdin/stdout, it,
    on the other hand, can receive 'command' and 'deliver' information to
    other processes via a Unix domain socket it create and listen when
    startup.

    Actuall the program's stdin/stdout is a channel to a external device
    ( it will be link to the device when in non-test mode, but in test
    mode, it just stdin/stdout hence don't really ask the device
    presented ). The program communicate with its external devices and
    interact with other processes via aother channel -- a Unix domain
    socket.

    My task is to write automatic tests for the program under
    development. It seems that Expect can help, but I am not sure.
    Basically, what I think is, run expect leting it feed inputs to the
    program's stdin and receive/check program's output on its stdout. The
    first problem I can image now is that I have raw data need to hand and
    Expect usually process ascii strings, am I right? Another problem is,
    I am not sure, if or not, while I use expect to ineteract with the
    program's stdin/stdout, can I still in the expect to communicate with
    the program's unix domain socket?

    Maybe I am writting too much and I hope someone understand my
    situation. If so, I hope you tell me, if or not the Expect is a right
    tool I can expect. And, I here someting like libexpect, do I also
    need it?

    Thanks in advance.

    -
    narke

  2. Re: Will the Expect suit to me? ( maybe NOT a wrong post )

    Steven Woody wrote:
    > Is this a right group to ask question about Expect programming? I
    > search the Usenet and have not found a group something like
    > comp.....expect. And, my qeustion is below.
    >
    > I am writing a Linux program which will talk to its stdin/stdout with
    > two kind of information:
    > 1, human readable strings ( send/receive )
    > 2, non-human-readable raw data ( send/receive )
    >
    > And, while the program is running and talking to the stdin/stdout, it,
    > on the other hand, can receive 'command' and 'deliver' information to
    > other processes via a Unix domain socket it create and listen when
    > startup.
    >
    > Actuall the program's stdin/stdout is a channel to a external device
    > ( it will be link to the device when in non-test mode, but in test
    > mode, it just stdin/stdout hence don't really ask the device
    > presented ). The program communicate with its external devices and
    > interact with other processes via aother channel -- a Unix domain
    > socket.
    >
    > My task is to write automatic tests for the program under
    > development. It seems that Expect can help, but I am not sure.
    > Basically, what I think is, run expect leting it feed inputs to the
    > program's stdin and receive/check program's output on its stdout. The
    > first problem I can image now is that I have raw data need to hand and
    > Expect usually process ascii strings, am I right?


    I don't know which Expect you're speaking of. There is a TCL Expect
    (the original) and there is also an Expect module for Perl which does
    the same basic thing.

    Where I work, we use the Expect module for Perl, and we use it with
    non-ascii characters all the time. Well, technically they are
    ascii; they are just control characters. But the point is that they
    are non-printable characters. As far as I know, this isn't a problem.

    > Another problem is,
    > I am not sure, if or not, while I use expect to ineteract with the
    > program's stdin/stdout, can I still in the expect to communicate with
    > the program's unix domain socket?


    I don't know about the TCL/Expect, so the only comment I can make is
    about the Perl Expect. Looking at the documentation, you can either
    spawn an external command with spawn() (and that will use a pty) or
    you can use exp_init() to connect an Expect object to a different
    type of filehandle. The documentation gives the example of a filehandle
    returned by Net::Telnet, so I wouldn't be surprised if you could open
    a different type of socket and use that instead. I have definitely
    never tried this, so there could be some problem with the idea, but
    it seems feasible.

    - Logan

  3. Re: Will the Expect suit to me? ( maybe NOT a wrong post )

    On Jun 9, 2:51 am, Logan Shaw wrote:
    > Steven Woody wrote:
    > > Is this a right group to ask question about Expect programming? I
    > > search the Usenet and have not found a group something like
    > > comp.....expect. And, my qeustion is below.

    >
    > > I am writing a Linux program which will talk to its stdin/stdout with
    > > two kind of information:
    > > 1, human readable strings ( send/receive )
    > > 2, non-human-readable raw data ( send/receive )

    >
    > > And, while the program is running and talking to the stdin/stdout, it,
    > > on the other hand, can receive 'command' and 'deliver' information to
    > > other processes via a Unix domain socket it create and listen when
    > > startup.

    >
    > > Actuall the program's stdin/stdout is a channel to a external device
    > > ( it will be link to the device when in non-test mode, but in test
    > > mode, it just stdin/stdout hence don't really ask the device
    > > presented ). The program communicate with its external devices and
    > > interact with other processes via aother channel -- a Unix domain
    > > socket.

    >
    > > My task is to write automatic tests for the program under
    > > development. It seems that Expect can help, but I am not sure.
    > > Basically, what I think is, run expect leting it feed inputs to the
    > > program's stdin and receive/check program's output on its stdout. The
    > > first problem I can image now is that I have raw data need to hand and
    > > Expect usually process ascii strings, am I right?

    >
    > I don't know which Expect you're speaking of. There is a TCL Expect
    > (the original) and there is also an Expect module for Perl which does
    > the same basic thing.
    >
    > Where I work, we use the Expect module for Perl, and we use it with
    > non-ascii characters all the time. Well, technically they are
    > ascii; they are just control characters. But the point is that they
    > are non-printable characters. As far as I know, this isn't a problem.
    >
    > > Another problem is,
    > > I am not sure, if or not, while I use expect to ineteract with the
    > > program's stdin/stdout, can I still in the expect to communicate with
    > > the program's unix domain socket?

    >
    > I don't know about the TCL/Expect, so the only comment I can make is
    > about the Perl Expect. Looking at the documentation, you can either
    > spawn an external command with spawn() (and that will use a pty) or
    > you can use exp_init() to connect an Expect object to a different
    > type of filehandle. The documentation gives the example of a filehandle
    > returned by Net::Telnet, so I wouldn't be surprised if you could open
    > a different type of socket and use that instead. I have definitely
    > never tried this, so there could be some problem with the idea, but
    > it seems feasible.
    >
    > - Logan


    Hi, Logan

    I am using TCL Expect on Linux, version number is 5.43.0. I think non-
    pritable character is okay. My point is, when I need raw, I mean I
    anything sent out of sender will be exactly received by the receiver.


+ Reply to Thread