View Full Version : Return Pass/Fail from a function call
How do I return a Pass/Fail from a funciton call?
kinook
10-21-2005, 08:05 AM
What do you mean by function call? A script function? What language?
Whoops,
When I call to a subroutine call and I want to return a fail.
Ken
kinook
10-21-2005, 10:26 AM
You don't typically return success/failure from a subroutine -- if a step of the subroutine fails, the build will automatically stop on that step (after building failure steps if specified) so that the problem can be corrected and the build continued. If that doesn't work, please describe your situation and needs in a little more detail, and we may be able to provide some suggestions.
OK,
I am building over a 100 different files and I want to record at the highest level of subroutines when it fails. So when I execute a "Build File" subroutine call(Which calls other subroutines), it's going to pass/fail. On ether case, I would like it to continue so I will have the "Ignore Failures" checked.
But I would like to see if it pass/failed at the higher levels by the result of that subroutine call. I would expect that I need to force the result in LastStepStatus so when it returns this value has the correct Pass/Fail value in it.
Ken
kinook
10-22-2005, 04:17 PM
The LASTSTEP_STATUS macro will contain the build status of the last completed step (the last step in a subroutine when returning from a subrouting). If your subroutine has multiple steps marked to ignore failure and you want to know if any of them failed to build, there are a couple ways to approach it:
1) After the Subroutine Call step, add a Run Script step that uses the VBP object model to locate the subroutine and check the BuildStatus property of each step.
2) In the vbld_StepDone script event of each step within the subroutine, check the Step.BuildStatus property and create/update a temporary macro (i.e., SUB_FAILED) if the step failed. Then after calling the subroutine, use that temporary macro value to determine if the subroutine failed.
The attached sample demonstrates both methods.
Note: This sample project requires VBP v6.
vBulletin® v3.8.11, Copyright ©2000-2024, vBulletin Solutions Inc.