LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Pre-build or post-build steps to execute automated tests

Before building the final executable I need to compile some of the source files to build and run some tests over the source code.

I'm going to use one of the existing test frameworks (greates, cpputest, gtest, check, ...).

Only if all the test pass, the build of the executbale can be started.

 

Is there a document desribing how to use pre-build or post-build actions to get this result?

Or, is there a different approach?

 

Thanks

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 9
(1,779 Views)

Hello vix,

there's is a compile.exe utility that comes with CVI. It just compiles the prj file you give it. So you can write scripts around it and make it part of your test framework.

0 Kudos
Message 2 of 9
(1,739 Views)

Hi @gdardaud

I think you refer to https://www.ni.com/docs/en-US/bundle/labwindows-cvi-2020/page/cvi/usermanual/cmdlineinterface.htm

 

The problem is that I need to specify the flags to be passed to the compiler because I need to fine tune the behavior of the compiler.

Is there a way to do this?

 

Thanks

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 9
(1,732 Views)

Yes, that's it.

 

What do you mean by 'flags' ?

If it's compiler #define, you can pass /Dmydefine=toto

If it's project options, you can possibly grep/replace inside the prj before calling compile.exe

If it's more global compiler options, you can pass a specific ecc file (it's text also) (I think, I've never tried). At a minima you can have multiple configurations.

0 Kudos
Message 4 of 9
(1,725 Views)

I mean the several command line options supported by the compiler.

As an example, for GCC they're listed here.

I don't understand what you mean with "pass a specific ecc file".

Can you provide a link describing the syntax for this file?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 5 of 9
(1,719 Views)

CVI doesn't have all the options that gcc (or even the Clang it relies on) has. You can emulate that by having several configurations (or several prj files).

 

I got the ecc confused with CVI for Linux, the equivalent of compile.exe is cvicc and it uses a global .ecc configration file which is easy to change (you can change compiler, includes, libraries, options, etc in it). I thought compile.exe used the same system but it doesn't appear so. Sorry.

0 Kudos
Message 6 of 9
(1,714 Views)

I investigated and I saw that if I enable custom build actions, a lot of files are creted under cvibuild.xxxxxx\[Debug|Release|...] folder.

Some of the files are BuildStep.bat, CallCC.bat, ...

Inside them I can see how the compiler is called

@echo Compiling %FileNum% %SrcFileName%
@"c:\program files\national instruments\cvi2015\bin\clang\3.3\clang.exe" -cc1 -nostdsysteminc -fno-builtin-include-notes....

 

but I don't uderstand if (and how) I can twek this call

 

Is there a way?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 7 of 9
(1,709 Views)

Not sure if this can be done in some way.

 

In the meanwhile I have another need, and I don't find documentation on how to do this:

is there a way to use a pre-build action that checks something, and if the check fails the build step is not executed?

 

The main project depends on another project which contains a set of tests (built and executed).

If the execution fails, I don't want that the main project is built.

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 8 of 9
(1,688 Views)

A lot of time passed by, but I haven't find yet a way to solve this need:

how can I write a custom pre-build script so that it fails the build is not executed?

The build can require a lot of time, and if my pre-build step doesn't succeed, I don't like wasting time waiting for the build to complete.

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 9 of 9
(277 Views)