diff --git a/script/tests/devices/XMA0310/.config b/script/tests/devices/XMA0310/.config new file mode 100644 index 0000000..60eb5e9 --- /dev/null +++ b/script/tests/devices/XMA0310/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:57:25 CEST 2017 +name=XMA0310 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J101030"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMA0311/.config b/script/tests/devices/XMA0311/.config new file mode 100644 index 0000000..24c2268 --- /dev/null +++ b/script/tests/devices/XMA0311/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:58:05 CEST 2017 +name=XMA0311 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J101030"&"RPS module EPICS channel name";expectedValue2&"0x0001"&"[hex] expected value 2";expectedValue1&"0x000D"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMA0410/.config b/script/tests/devices/XMA0410/.config new file mode 100644 index 0000000..c07e7dd --- /dev/null +++ b/script/tests/devices/XMA0410/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:58:37 CEST 2017 +name=XMA0410 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:7"&"RPS EPICS attribute";rpsModule&"J101046"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMA1115/.config b/script/tests/devices/XMA1115/.config new file mode 100644 index 0000000..958b3d6 --- /dev/null +++ b/script/tests/devices/XMA1115/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:53:14 CEST 2017 +name=XMA1115 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J102007"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMA1116/.config b/script/tests/devices/XMA1116/.config new file mode 100644 index 0000000..1f8c70d --- /dev/null +++ b/script/tests/devices/XMA1116/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:41:43 CEST 2017 +name=XMA1116 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J102007"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMA1117/.config b/script/tests/devices/XMA1117/.config new file mode 100644 index 0000000..1454885 --- /dev/null +++ b/script/tests/devices/XMA1117/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:53:44 CEST 2017 +name=XMA1117 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J102007"&"RPS module EPICS channel name";expectedValue2&"0x1000"&"[hex] expected value 2";expectedValue1&"0xD000"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMA1118/.config b/script/tests/devices/XMA1118/.config new file mode 100644 index 0000000..04bc1ae --- /dev/null +++ b/script/tests/devices/XMA1118/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:40:33 CEST 2017 +name=XMA1118 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:7"&"RPS EPICS attribute";rpsModule&"J102025"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMA1119/.config b/script/tests/devices/XMA1119/.config new file mode 100644 index 0000000..49addfb --- /dev/null +++ b/script/tests/devices/XMA1119/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:41:13 CEST 2017 +name=XMA1119 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J102007"&"RPS module EPICS channel name";expectedValue2&"0x0001"&"[hex] expected value 2";expectedValue1&"0x000D"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMB0510/.config b/script/tests/devices/XMB0510/.config new file mode 100644 index 0000000..fdc4185 --- /dev/null +++ b/script/tests/devices/XMB0510/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 14:02:17 CEST 2017 +name=XMB0510 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J108053"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMC0610/.config b/script/tests/devices/XMC0610/.config new file mode 100644 index 0000000..bf9394b --- /dev/null +++ b/script/tests/devices/XMC0610/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 14:00:49 CEST 2017 +name=XMC0610 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J110060"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMC2010/.config b/script/tests/devices/XMC2010/.config new file mode 100644 index 0000000..2753f2e --- /dev/null +++ b/script/tests/devices/XMC2010/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 14:01:23 CEST 2017 +name=XMC2010 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J117065"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMC2011/.config b/script/tests/devices/XMC2011/.config new file mode 100644 index 0000000..3dc2824 --- /dev/null +++ b/script/tests/devices/XMC2011/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 14:01:52 CEST 2017 +name=XMC2011 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J117065"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMD0710/.config b/script/tests/devices/XMD0710/.config new file mode 100644 index 0000000..14e1a37 --- /dev/null +++ b/script/tests/devices/XMD0710/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:59:03 CEST 2017 +name=XMD0710 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J124081"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMD0711/.config b/script/tests/devices/XMD0711/.config new file mode 100644 index 0000000..c262689 --- /dev/null +++ b/script/tests/devices/XMD0711/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:59:41 CEST 2017 +name=XMD0711 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J124081"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XMD0717/.config b/script/tests/devices/XMD0717/.config new file mode 100644 index 0000000..2c935f5 --- /dev/null +++ b/script/tests/devices/XMD0717/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 14:00:11 CEST 2017 +name=XMD0717 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J124092"&"RPS module EPICS channel name";expectedValue2&"0x0001"&"[hex] expected value 2";expectedValue1&"0x000D"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XME1310/.config b/script/tests/devices/XME1310/.config new file mode 100644 index 0000000..a66d3fc --- /dev/null +++ b/script/tests/devices/XME1310/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:54:46 CEST 2017 +name=XME1310 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:6"&"RPS EPICS attribute";rpsModule&"J112009"&"RPS module EPICS channel name";expectedValue2&"0x0001"&"[hex] expected value 2";expectedValue1&"0x000D"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XME1311/.config b/script/tests/devices/XME1311/.config new file mode 100644 index 0000000..c42d1e2 --- /dev/null +++ b/script/tests/devices/XME1311/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:55:53 CEST 2017 +name=XME1311 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J112023"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XME1410/.config b/script/tests/devices/XME1410/.config new file mode 100644 index 0000000..1d114f8 --- /dev/null +++ b/script/tests/devices/XME1410/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:56:25 CEST 2017 +name=XME1410 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J112023"&"RPS module EPICS channel name";expectedValue2&"0x0001"&"[hex] expected value 2";expectedValue1&"0x000D"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/devices/XME1411/.config b/script/tests/devices/XME1411/.config new file mode 100644 index 0000000..f874918 --- /dev/null +++ b/script/tests/devices/XME1411/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:56:53 CEST 2017 +name=XME1411 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J112023"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/tests.properties b/script/tests/tests.properties index 771c58e..9c09ff8 100644 --- a/script/tests/tests.properties +++ b/script/tests/tests.properties @@ -1,5 +1,5 @@ #TestingList for pshell: configuration properties -#Fri Oct 20 14:51:31 CEST 2017 +#Fri Oct 20 14:55:35 CEST 2017 customPanel= showEnabledTestsOnly=true listFilter=rps-test diff --git a/script/tests/tests/RPS Tests Diagnostic/Diagnostic/.config b/script/tests/tests/RPS Tests Diagnostic/Diagnostic/.config new file mode 100644 index 0000000..8460d43 --- /dev/null +++ b/script/tests/tests/RPS Tests Diagnostic/Diagnostic/.config @@ -0,0 +1,4 @@ +#Fri Oct 20 13:31:23 CEST 2017 +name=Diagnostic +parameters=setGetDelay&"1"&"[s] delay between set and get"; +description=Test interlocks of diagnostic modules by generating a pulse diff --git a/script/tests/tests/RPS Tests Diagnostic/Diagnostic/Diagnostic.py b/script/tests/tests/RPS Tests Diagnostic/Diagnostic/Diagnostic.py new file mode 100644 index 0000000..fc7066f --- /dev/null +++ b/script/tests/tests/RPS Tests Diagnostic/Diagnostic/Diagnostic.py @@ -0,0 +1,143 @@ +# Test name: Diagnostic +# Test interlocks of diagnostic modules by generating a pulse +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + setGetDelay = float(test.getParam('setGetDelay')) + rpsAttribute = test.getParam('rpsAttribute') + rpsModule = test.getParam('rpsModule') + expectedValue2 = test.getParam('expectedValue2') + expectedValue1 = test.getParam('expectedValue1') + except: + import traceback + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + #rpsCh = Channel(test.getDeviceName() + ':' + rpsAttribute , type='d') + test.log('doing nothing here...') + except: + import traceback + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + # get value (it is translated to a caget): + # motor_msta = pv_motor_msta.get() + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + #rpsCh.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/tests/RPS Tests Diagnostic/Diagnostic/help.html b/script/tests/tests/RPS Tests Diagnostic/Diagnostic/help.html new file mode 100644 index 0000000..9391d6f --- /dev/null +++ b/script/tests/tests/RPS Tests Diagnostic/Diagnostic/help.html @@ -0,0 +1,16 @@ + + +
+setGetDelay | [s] delay between set and get |