After you set the 'virtualenv', you need to activate it to run the code for your tests.
(Note: codes are located inside the dev_tools)
Python 2.7.12 Installation
If you dont have python 2.7.12 version (it is better than 2.6.X version) you can install it as following:
Now you have python 2.7.12. If you also want to install ipython:
Running the AMCT Tool
Before running the AMCT tool you can look at the help options:
> dev_tools]$ amct --help
Usage: amct [OPTIONS] COMMAND [ARGS]...
Options:
-v, --verbose
-d, --debug
-l, --log-level [INFO|DEBUG|WARNING|ERROR|CRITICAL]
-c, --config PATH Global configuration
--version Show the version and exit.
-h, --help Show this message and exit.
Commands:
amctool Utilities for testing AMC13 interactively.
firmware Operations for testing AMC13 firmware.
testsuite Run predefined test-suites against AMC13...
AMCT tool executes all the AMC13Tool2 commands and run them using new scripting language, such as:
For example:
>amc.do('en 1-12 f t')
>amc.do('localL1A o 1')
>amc.do('lt 5')
>amc.do('rv STATUS*')
>amc.do('re') #etc...
or
For example:
>amc.run('en 1-12 f t')
>amc.run('localL1A o 1')
>amc.run('lt 5')
>amc.run('rv STATUS*')
>amc.run('re') #etc...
Info : If you want to print the test result as a table just say:
>print amc.do('any AMC13Tool2_command')
For example:
> print amc.do('nodes t1 *ttc*error*')
9 nodes matched
0: STATUS.TTC.BCNT_ERROR (addr=00000000 mask=00000040) r
1: STATUS.TTC.BCNT_ERRORS_HI (addr=00000045 mask=0000ffff) r
2: STATUS.TTC.BCNT_ERRORS_LO (addr=00000044 mask=ffffffff) r
3: STATUS.TTC.MULT_BIT_ERROR (addr=00000000 mask=00000100) r
4: STATUS.TTC.MULT_BIT_ERRORS_HI (addr=00000043 mask=0000ffff) r
5: STATUS.TTC.MULT_BIT_ERRORS_LO (addr=00000042 mask=ffffffff) r
6: STATUS.TTC.SGL_BIT_ERROR (addr=00000000 mask=00000080) r
7: STATUS.TTC.SGL_BIT_ERRORS_HI (addr=00000041 mask=0000ffff) r
8: STATUS.TTC.SGL_BIT_ERRORS_LO (addr=00000040 mask=ffffffff) r
Code is working as Command-line tool for:
Testing AMC13 Cards Using Interactive Mode
In this method you will run the code inside python (better you install python 2.7 and use ipython), you will exacute all the commands from AMC13Tool2 and use them.
If you use ipyhon do:
>amct amctool ipython -i 322 ## SerialNumber=322
If you use pyhon do:
>amct amctool python -i 322
Then start to do test!!!
Here is an example to check registers and looking at differences of registers with and without trigger using interactive mode.
>r1 = amc.get_registers() # get registers
>r1['STATUS.AMC01.COUNTERS.AMC13_AMC_EVENTS_LO'] #check specific register
>amc.do('en 1-12 f t') # create fake events
>amc.do('localL1A o 1 1') # configure localL1A)
>amc.do('lt 5') # send 5 triggers
>r2 = amc.get_registers() # get registers
>r2['STATUS.AMC01.COUNTERS.AMC13_AMC_EVENTS_LO'] # check specific register after send 5 trig.
>rdiff = amc.diff_registers(r1, r2) # define diff function to check the differences with/without trig.
>rdiff['STATUS.AMC01.COUNTERS.AMC13_AMC_EVENTS_LO'] # check diff of registers with/without trig.
Testing AMC13 Cards Using Scripted Mode
In this method you can run your commands inside the script that you prepared and can test the AMC13 cards. I have prepared an example which will test the event and time counter registers. This script will check the expected and observed values of the register(s) and compare the expected value with observed value. If the expected/observed values are equal test result will be OK. Here is the example of the script:
test1.pyamc : script to check some registers.
Tests are organized into testsuite. You can execute them against every AMC13 board like so:
amct --verbose testsuite run --name c01 -i 161/c
(SN =161 and c01: a folder that contain the test1.pyamc script)
--> If expected and observed values are the same then you will see below message:
INFO 13772 [08/17/2016 14:02:51]: Testsuite c01 finished OK
--> If expected and observed values are different then you will see the message of the problematic register and its expected and observed values!
STATUS.SFP.SFP0.EVENTS_BUILT error, expected: 6, observed: 5
-- SemirayGirgisChyla - 08 Aug 2016