NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with SequenceFileLoad on automated tests

Hello everyone.
I wanted to lock our testenvironment framework seq files from everyone, just allowing some people to edit those files.
To achieve this a added Custom Privileges to our User Management. So I was able to give each framework user it's indiviual right to edit the files in the framework.
On the SequenceFileLoad Callback of the Framework File, I check the user Privileges and if he has I Unlock the file. 
 

if (CurrentUserHasPrivilege("editTestEnv"))  

RunState.SequenceFile.AsPropertyObjectFile().Unlock("restricted")  

(Of course smart fellows will find out the PWD, but I just wanted to make it difficult not impossible)

 This is worked as expected.  

 

Now, when executing a test, the test sporadically freezes.  

I am guessing that it involves an Known Issue[155319] around the SequenceFileLoad callback.

 

So I tried to use the GetSeqFileOptions.GetSeqFile_DoNotRunLoadCallback when getting the testcases seq file.
But as the actual Callback is in the framework sequences, I am not sure if these load callbacks are also ignored.


 

Does anyone has a clue how to come up with a smart user management to avoid unwanted editors

or

a way around the above issue?

 

thx
Marcos V. Bischoff
0 Kudos
Message 1 of 7
(3,395 Views)

That known issue does not sound like it has anything to do with load callbacks. It is related to unload callbacks used with remote executions.

 

What do you mean by sporadically freezes? Does it continue to run after some time? If so how long? Can you attach an example file which reproduces the problem?

 

You are correct that the GetSeqFile_DoNotRunLoadCallback applies only to the file that is directly being loaded.

 

-Doug

0 Kudos
Message 2 of 7
(3,389 Views)

Hi, thanks for the answer.
The application hang is quite strange.
We use a console to build up the simplest way of an TS application

I use the following code to execute a test.

this

int msecTSTimeout = this.mainWorker.myConfiguration.getTSTimeout() * 60000;

bool isExecuted = this.myExecution.WaitForEndEx(msecTSTimeout, true, null, null);

The application hang occures after the last code line of the application has passed an the retun code is returned. But the app doesn't close.

It is quite strange, because it seems that TS and the App are finished and there is no error indication at all. But Removing the Callbacks solves the problem.

Unfortunatly a cannot add anything to reproduce the error. It happens quite sporadically.

We can live with some tests randomly failing, but  I want to know what is going wrong.

Besides that i think the above mentioned user priviges are quite neat and i do want to keep that. 

 

thx
Marcos V. Bischoff
0 Kudos
Message 3 of 7
(3,375 Views)

this is the correct code block:

this

.mySeqFile = this.myEngine.GetSequenceFileEx(_mySeqFilePath,GetSeqFileOptions.GetSeqFile_DoNotRunLoadCallback,TypeConflictHandlerTypes.ConflictHandler_Error);

..

this.myExecution = myEngine.NewExecution(this.mySeqFile,this.mainWorker.myConfiguration.ProcessModelEntryPoint,this.myProcessModelFile,false,ExecutionTypeMask.ExecTypeMask_Normal,null, null, null);
..

bool

isExecuted = this.myExecution.WaitForEndEx(msecTSTimeout, true, null, null);

thx
Marcos V. Bischoff
0 Kudos
Message 4 of 7
(3,372 Views)

A couple of issues to be aware of.

 

1) It looks like you are using .NET and C# correct?

2) You need to make sure that the engine is released last, which is a bit tricky to do in .NET because of garbage collection. One way to do this is to call GC.Collect() after all your other references to TestStand objects are gone (or set to null) other than the Engine. The engine should still be held onto when you call GC.Collect() so that it will be freed last.

3) Do you also have unload callbacks? If so you will need to do a more complicated shutdown process. If you use the ApplicationMgr control it will do this for you, or you can implement it at a lower level with the TestStand API. If you don't have unload callbacks then this isn't required.

4) Are you calling ReleaseSequenceFileEx on the reference you got by calling GetSequenceFileEx? If not, you should be doing so.

 

Hope this helps,

-Doug

0 Kudos
Message 5 of 7
(3,352 Views)

yes we are using .Net / C#

we will have a look at the garbage collection on closing the console.

we don't use unload callbacks. Just tried the load callback and they didn't work

already using ReleaseSequenceFileEx and "nulling" every TS variable.

We soon will have a look on TS 2010. Where there chenges on th eload callback comparde to TS 4.2?


Besides the application hang

I also wanted to Know if there is a way to use custom indiviual privileges to allow or prevent editing of sequence files using the sequence editor?

thx
Marcos V. Bischoff
0 Kudos
Message 6 of 7
(3,319 Views)

I don't think there are any known issues with the Load callback that would lead to the problem you are describing. Is this issue happening with a custom user interface? Have you tried using the sequence editor? Can you reproduce the hang if you use the sequence editor?

 

There is no built-in way to restrict access to a particular file based on the login of the current user. You could post such an idea to the idea exchange to help gauge interest in having such a feature.

 

Hope this helps,

-Doug

0 Kudos
Message 7 of 7
(3,301 Views)