2

In order to enforce traceability of the test environment, we'd like to have a system variable in the CANoe configuration, storing a simple string that references the version of the configuration itself.

What we are trying to achieve is the following:

on preStart
{
    @versionsysvar = // callback of a command line call returning the version as a string
}

Both SysExec and SysExecCmd are not an option. So far, I couldn't find a way that doesn't involve creating a dll wrapper, import it and run it. I wander if, maybe, there is a way, after all. Any ideas?

EDIT

Let's say the configuration is shared under SVN. It might be any versioning system of sort. Each tester has a branch with some degree of freedom, so that the version number must be fetched at each measurement start. E.g. When measurement start, goal is to populate a system variable with current Revision number of SVN, retrieved via a command line call.

Please note, this is just an example. What I'd like to avoid, if possible, is to add a third element, say a dll or a COM object fetching the versioning object.

Ref: In CAPL, is there any function to start/open an executable in background?

Daemon Painter
  • 3,208
  • 3
  • 29
  • 44
  • 1
    What about going the other way by calling an executable which would in turn set the system variable using the COM interface? Calling external processes and waiting for the result does not really fit to CANoes internal architecture. – MSpiller Dec 16 '19 at 19:38
  • yes, that is option 3 I believe. It is actually a good one, but either way I need to code something and compile it. I wandered if there was a way with pure CAPL / scripting. Actually today I got something to work: write a file on preStart, read it on Start. But a lot of things might go wrong in the meantime. – Daemon Painter Dec 16 '19 at 19:49
  • Can you elaborate on how the _version of the configuration_ is accessible? Is it part of the name of the CANoe config, stored in a separate file, ...? – MSpiller Dec 17 '19 at 08:19
  • I've added some details :) – Daemon Painter Dec 17 '19 at 08:57
  • 1
    I did something like this once for a customer. What we did is implementing a svn "post commit hook" on the server which created a .cin file containing the svn-revision which could then be used in CAPL (we were using it as a CAPL variable, not (directly) a system variable. Everything else was too fragile. HTH – MSpiller Dec 18 '19 at 10:19
  • that looks like a stronger method than my current alternative, for timing reasons mostly. Thanks for sharing it! – Daemon Painter Dec 18 '19 at 11:05

1 Answers1

-2

One possible option could be to route the output of command to a text file as shown below :

sysExecCmd("dir", ">D:\Output.txt")

Once the sysExecCmd command is executed, the Console environment is triggred for 'dir' command execution and the output is written to text file.

The file Output.txt can be read using CAPL file functions and monitored for output. Please note that this is a workaround and not a straight forward solution

Ravi
  • 1
  • 3