From ed1260465a6974efb3bd0ea76bae2cc0f655ddae Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 10 Jan 2024 18:37:30 -0800 Subject: [PATCH] Updated ValidationSimple (markdown) --- ValidationSimple.md => Validators-in-C.md | 86 +---------------------- 1 file changed, 2 insertions(+), 84 deletions(-) rename ValidationSimple.md => Validators-in-C.md (64%) diff --git a/ValidationSimple.md b/Validators-in-C.md similarity index 64% rename from ValidationSimple.md rename to Validators-in-C.md index 342a2d5..1a326c4 100644 --- a/ValidationSimple.md +++ b/Validators-in-C.md @@ -1,6 +1,5 @@ -# Developing a custom validator - -To create a validator, you must supply three functions: +You can create a validators in C++. +To do so, you must supply three functions: ```c extern int init_result(RESULT& result, void*& data); @@ -121,85 +120,4 @@ int cleanup_result(RESULT const& r, void* data) { Developed your validators outside the BOINC source tree; a see the Makefile in boinc/sched/Makefile.example. -## Using scripting languages -The validator **script_validator** allows you to write your validation logic -in your language of choice (Python, PHP, Perl, Java, bash). -**script_validator** takes two additional command-line arguments: - -### **--init_script "filename arg1 ... argn"** -script to check the validity of a result. Exit zero if valid. -### **--compare_script "filename arg1 ... argn"** -script to compare two results. Exit zero if outputs are equivalent. - -**arg1 ... argn** represent cmdline args to be passed to the scripts. -The options for init_script are: -### **files** -list of paths of output files of the result -### **result_id** -result ID -### **runtime** -task runtime in seconds - -Additional options for compare_script, for the second result: -### **files2** -list of paths of output files -### **result_id2** -result ID -### **runtime2** -task runtime - -**arg1 ... argn** can be omitted, -in which case only the output file paths are passed to the scripts. - -The scripts must be put in your project's bin/ directory. - -For applications that don't use replication, the compare script need not be given. -For applications that don't need output file syntax checking, the init script need not be given. - -As an example, the following PHP script, used as a compare script, -would require that results match exactly: -```php -#/usr/bin/env - -``` - -The corresponding entry in config.xml would look like -```xml - - script_validator --app uppercase -d 3 --compare_script compare.php - -``` - -## Testing your validator - -While you're developing a validator, -it's convenient to run it in "standalone mode", -i.e. run it manually against particular output files. -BOINC provides a test harness that lets you do this: - -* In boinc/sched/, copy **makefile_validator_test** to your own file, say **makefile_vt**. -* Edit this makefile, changing VALIDATOR_SRC to refer to the .cpp file - containing your init_result(), compare_result(), and cleanup_result() functions. -* Do **make -f makefile_vt**. - -This creates a program **validator_test**. -Do -``` -validator_test file1 file2 -``` -to test your code against the given output files. -It will show the result of each function call. - -Notes: -* Currently this assumes that results have a single output file. - If you need this generalized, let us know.