kopia lustrzana https://github.com/bristol-seds/pico-tracker
Added makefile for making new tcs
rodzic
68aca94548
commit
ed27b1c0b2
|
@ -1,6 +1,7 @@
|
||||||
datasheets
|
datasheets
|
||||||
firmware/test/ctypesgen/.svn
|
firmware/test/ctypesgen/.svn
|
||||||
firmware/test/main.py*
|
firmware/test/main.py*
|
||||||
|
firmware/test/.testcommand
|
||||||
|
|
||||||
*.s#*
|
*.s#*
|
||||||
*.b#*
|
*.b#*
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#
|
||||||
|
# Makes new test cases
|
||||||
|
#
|
||||||
|
|
||||||
|
ECHO := echo
|
||||||
|
SED := sed
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
.PHONY: new
|
||||||
|
new:
|
||||||
|
ifdef name
|
||||||
|
@$(ECHO)
|
||||||
|
@$(ECHO) "Creating $(name)_tc..."
|
||||||
|
@$(SED) "s/\[template\]/$(name)/g" template/template.h > tc/$(name).h
|
||||||
|
@$(SED) "s/\[template\]/$(name)/g" template/template.py > tc/$(name).py
|
||||||
|
@$(ECHO) "Done"
|
||||||
|
else
|
||||||
|
@$(ECHO) "Please specify a name for the test case!! Like 'make name=my_tc'"
|
||||||
|
endif
|
|
@ -47,6 +47,10 @@ program is then run, and one loop of `tc_main` runs the test case.
|
||||||
|
|
||||||
#### Writing a new test case
|
#### Writing a new test case
|
||||||
|
|
||||||
|
```
|
||||||
|
From this directory you can just run 'make name=<new_name>'
|
||||||
|
```
|
||||||
|
|
||||||
* Choose a testcase name `[tc-name]`
|
* Choose a testcase name `[tc-name]`
|
||||||
* Create `tc/[tc-name].py` and `tc/[tc_name].h`. Use a pre-existing test case as a template.
|
* Create `tc/[tc-name].py` and `tc/[tc_name].h`. Use a pre-existing test case as a template.
|
||||||
* Add `#include [tc-name].h` to the section at the top of `main.c`
|
* Add `#include [tc-name].h` to the section at the top of `main.c`
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
#ifndef __verification__
|
||||||
|
#define __verification__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************//* [template]_tc *//****************************/
|
||||||
|
/**
|
||||||
|
* Write a description of your test case here
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Parameters in */
|
||||||
|
struct [template]_tc_params {
|
||||||
|
|
||||||
|
/* Input paramters to your test case go here */
|
||||||
|
|
||||||
|
} [template]_tc_params;
|
||||||
|
/* Results out */
|
||||||
|
struct [template]_tc_results {
|
||||||
|
|
||||||
|
/* Result values should be populated here */
|
||||||
|
|
||||||
|
} [template]_tc_results;
|
||||||
|
/* Function */
|
||||||
|
__verification__ void [template]_tc(void) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main body of the test case goes here.
|
||||||
|
*
|
||||||
|
* Use the input parameters to run the test case. Populate the
|
||||||
|
* results structure at the end
|
||||||
|
*/
|
||||||
|
|
||||||
|
[template]_tc_results.result = 2 * [template]_tc_params.input;
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Imports
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import sys
|
||||||
|
sys.path.append("./test")
|
||||||
|
import main
|
||||||
|
|
||||||
|
from random import randint
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Test Script
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class [template]_tc:
|
||||||
|
def __init__(self):
|
||||||
|
self.name = self.__class__.__name__
|
||||||
|
self.iterations = 20
|
||||||
|
|
||||||
|
|
||||||
|
def get_test(self):
|
||||||
|
"""Returns some suitable test parameters"""
|
||||||
|
params = main.struct_[template]_tc_params()
|
||||||
|
|
||||||
|
"""
|
||||||
|
Assign input parameters here
|
||||||
|
"""
|
||||||
|
|
||||||
|
return params
|
||||||
|
|
||||||
|
def is_correct(self, params, result, print_info):
|
||||||
|
"""Returns if a result is correct for the given parameters"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
Compare result and params here, decide sth.
|
||||||
|
Can use print_info
|
||||||
|
"""
|
||||||
|
|
||||||
|
return True
|
Ładowanie…
Reference in New Issue