NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand deployment of source code

After I build a deployment (in Teststand) and install it at the target, when I select Test UUTs, I get an error saying that it can't find the .c file associated with the first test in the sequence. I began seeing the error when I unchecked the source file from the Distributed Files tab. I don't really understand why I need to distribute all my source files. I created a static library (in CVI) from a project that contains all the same source files as in the CVI project I use to create the executable version of the app, and I include the lib in my TestStand workspace. I thought that is all I would need for the TS sequence to be able to find my tests. Am I not understanding something (loaded question).

I'm wondering if I should be creating an executable version anyway. Should I be creating a DLL instead. My app includes tscvirun_supp.c, but I don't think that does anything by itself. The only main that seems to do anything is found in TestExec.c, but that is run indirectly of my app code.
0 Kudos
Message 1 of 13
(4,037 Views)
Hi,

"I get an error saying that it can't find the .c file associated with the first test in the sequence."

This is because the step within your sequence is calling the source .c file. If this is the case, you need to check the source file from the Distributed Files tab when running the Deployment Utility.

However I'd recommend creating a dll from the source file and using the dll instead. So when you deploy, you are not giving away the source code.

So essentially as part of your TestStand WorkSpace, you'll have one TestStand Project. Inside this project, you'll include your sequence files. Once you have included the sequence files, right click on the sequence file and click on "Insert Code Modules". This will automatically add all your .dll files called from with your steps and sequences. You'll also include your operator interface executable. So now you don't have any CVI projects or source code as part of your workspace.

"My app includes tscvirun_supp.c, but I don't think that does anything by itself."

To execute tests in an external instance of LabWindows/CVI, the LabWindows/CVI Adapter launches a copy of the LabWindows/CVI development environment and loads an execution server project. The default project is tscvirun.prj.

When a TestStand step calls a function in an object, static library, or DLL file, the execution server project automatically loads the code module and executes the function in an external instance of LabWindows/CVI. If you
want a TestStand step to call a function in a C source file, you must include the C source file in the execution server project before you run the project. You must also include any support libraries other than LabWindows/CVI libraries that the object, static library, or C source file requires.

Unless you have CVI installed on your deployment machine and you want your code modules to run in an separate process you don't need the tscvirun.prj which contains the tscvirun_supp.c file. Besides if you have using dll instead of the CVI source files then you don't have to include this CVI project as part of your deployment package.

I hope this helps

SijinK
National Instruments
Message 2 of 13
(4,013 Views)
I created the DLL, but I'm not sure about the Exports in the Target Settings. I currently have Symbols marked for export selected. Should I have "Include File Symbols" instead? I noticed in my CVI project, I do not include any of the .h files that correspond to the .c files that make up the tests. I'm assuming that if I have "Include File Symbols" selected, I would have to have those .h files in the project so that I could then select them from the list.
0 Kudos
Message 3 of 13
(3,999 Views)
Hello,

You are correct. If you'd like to select the "Include File Symbols" option for Exports in the Target Settings then you have to include your header files as part of your CVI project. I have personally always used this option because I like to add all my header files as part of the CVI project.

I hope this helps.

SijinK
National Instruments
0 Kudos
Message 4 of 13
(3,971 Views)
I'm so close now ... But, when I Execute (at the target) I see an Error in call to LoadPanel. It says it find one of my .uir files. However, in my CVI project, the uir in question is listed, and, the 'Embed Project UIRs' is checked in the Build::Target Settings. When working with DLLs, do the UIRs needed to be added to the TestStand workspace. Any ideas why it wouldn't be seeing the UIR?
0 Kudos
Message 5 of 13
(3,970 Views)
Hi,

you will need to include your UIR files in your deployment so that they are on your target machine.

They is an option in CVI to turn your UIR's in to c file, then you call a c function to create your panels at runtime.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 6 of 13
(3,959 Views)
I got past the previous UIR error. Now I see Error Code: -86 which I cant figure out. It says

The callback function, Shutdown, specified in the UIR file, is not a known function. If you are using an external compiler, you must include the UIR callbacks object or source file in the executable or DLL.

I included the prototype for the Shutdown function in the DLL export header file. However, I notice in the uir.h file, the Shutdown function uses the older calling convention of CVICALLBACK. Do I need to recreate/convert my UIR files that were created in CVI 6.0, to 7.1. Do I need to replace usage of CVICALLBACK with DLLSTDCALL. Can I even do that since at the top of the UIR.h files it says

WARNING: Do not add to, delete from, or otherwise modify the contents */
/* of this include file
0 Kudos
Message 7 of 13
(3,953 Views)
Ray,

I'm wondering if this is the problem. In MY code (which I inherited, and was built with older CVI & testexecutive), in the .c associated with the problemed .uir/.h, LoadPanel is used. However, in the TestExec.c file, LoadPanelEx is used. In the Help documentation for LoadPanelEx it states ...

LoadPanelEx is similar to LoadPanel, except that the callback functions you reference in your .uir file can be defined in the DLL that contains the call to LoadPanelEx.

Since I have all my source files built into a DLL now, must I replace LoadPanel with LoadPanelEx?
0 Kudos
Message 8 of 13
(3,935 Views)
Hi mrbean,

That should do the trick.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 9 of 13
(3,928 Views)
This is how LoadPanelEx is used in TestExec.c

// load the panels for the main window from the .UIR file
errChk( gMainWindow.panel = LoadPanelEx(0, UIR_FILE_NAME, MAINPANEL, __CVIUserHInst));
errChk( gMainWindow.fileTab = LoadPanelEx(gMainWindow.panel, UIR_FILE_NAME, FILETAB, __CVIUserHInst));

The Help for LoadPanelEx says about callingModuleHandle (the last parameter in LoadPanelEx)...

callingModuleHandle void pointer - The handle of the DLL in which to search for the callback functions referenced in the .uir.
In almost all cases, this is the handle of the DLL in which the call to LoadPanelEx is compiled.

Use the default parameter, __CVIUserHInst, to specify the handle of the module that contains the call to LoadPanelEx.

A value of 0 indicates your executable. If you pass 0, the function behaves identically to LoadPanel.


If I didn't use __CVIUserHInst, how would I reference my DLL export .h file.
I'm not sure what the preferred/correct implementation should be
0 Kudos
Message 10 of 13
(3,906 Views)