AMCT Python Software

General Explanations

The goal is to develop a set of routines to automatically (i.e. without human intervention) test AMC13 hardware using python language. Tests will exercise the functionality of the AMC13 card(s) and report errors/failures. The tool allows for a detailed testing of the AMC hardware in both supervised and non-supervised fashion and it is meant to be used as a part of the production and quality testing of the AMC13 hardware.

For python tool, typically you need to use `virtualenv` to create a separate python environment and install all dependencies. It creates a folder which contains all the necessary executables to use the packages that a Python project would need. Before starting, make sure you have 'pip' and 'virtualenv'. Use your favorite package manager to install them.


Virtualenv Installation

After you set the 'virtualenv', you need to activate it to run the code for your tests.

  • cd ./dev_tools
  • source virtualenv/bin/activate
  • pip install --upgrade pip
  • python develop

Python 2.7 Installation to Virtualenv

Inside the virtualenv you can also install python 2.7 version (it is better than 2.6) and use ipython (python 2.6 version does not support ipython). I have already put the Python-2.7.12.tgz file in the folder, you just need to run it as below:

  • cd Python-2.7.12
  • make clean
  • ./configure --prefix=/home/${USER}/.localpython
  • make
  • make install
  • pip install ipython

Now you have python 2.7.12 and ipython in virtualenv.

Running the AMCT Tool

AMCT tool executes all the AMC13Tool2 commands and run them using new scripting language, such as:

>'en 1-12 f t')
>'localL1A o 1') 
>'lt 5') 
>'rv STATUS*')
>'re') #etc...
  •'any AMC13Tool2_command') ##run=do (select your favorite one.)
>'en 1-12 f t')
>'localL1A o 1') 
>'lt 5') 
>'rv STATUS*')
>'re') #etc...

Info : If you want to print the test result as a table just say:

>print'any AMC13Tool2_command') 
For example:
> print'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:

  • Interactive mode
  • Scripted mode

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
>'en 1-12 f t')    : create fake events
>'localL1A o 1 1')    : configure localL1A)
>'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.

-- SemirayGirgisChyla - 08 Aug 2016

Edit | Attach | Watch | Print version | History: r14 | r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r8 - 17 Aug 2016 - SemirayGirgisChyla
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback