Daniel Jacobowitz wrote: > Works fine for me - very clever. This patch is OK. I'd recommend two > changes, at your discretion: > >> +send_gdb "if 1\necho true\\n\nelse\necho false\\n\nend\n" > > Due to the patterns you're matching, this is safe, but in general it's > bad style to use send_gdb without a matching gdb_expect. If you use > gdb_test with the third argument empty, it will not be registered > as a "test", and no pass message will be issued - unless the test > fails, that is. So this is useful for tests which aren't part of the > testcase, and are always assumed to pass. I could certainly do this. >> +# with true condition >> +send_gdb "if 1\nelse\nend\necho got here\\n\n" >> +gdb_expect { > > gdb_test_multiple is a little nicer here. You can still supply your > own eof handler; the only difference is that it will pick > up other quirky bits like internal error messages (and the default > timeout handler should be fine for you here). I have tried to do this, but have hit trouble. Please find my best effort attached. The problem is that it now calls perror which means that any test that fails due to a crash is marked UNRESOLVED, not FAIL. It also prevents any further tests in the file from running. So the result is that failures are not flagged up as clearly as they should be - you just get one unresolved test case instead of the proper handful of failures that would set the alarm bells ringing. It does do the right thing when everything passes. Andrew