| 1 |
#! /bin/ksh |
| 2 |
|
| 3 |
#directory where the executable is located |
| 4 |
project_dir=`pwd | sed -f delim.sed` |
| 5 |
|
| 6 |
#directory pointed to by the image attribute |
| 7 |
image_dir=`pwd | sed -e s:$:\\/image_dir: | sed -f delim.sed` |
| 8 |
|
| 9 |
#directory pointed to by the imagepath attribute |
| 10 |
imagepath_dir=`pwd | sed -e s:$:\\/imagepath_dir: | sed -f delim.sed` |
| 11 |
|
| 12 |
#an invalid absolute path |
| 13 |
inv_dir=`echo -n "/inv_dir" | sed -f delim.sed` |
| 14 |
|
| 15 |
#echo "project_dir=${project_dir}" |
| 16 |
#echo "abs_dir=${abs_dir}" |
| 17 |
#echo "rel_dir=${rel_dir}" |
| 18 |
#echo "cur_dir=${cur_dir}" |
| 19 |
#echo "inv_dir=${inv_dir}" |
| 20 |
|
| 21 |
#input parameters: |
| 22 |
# a - image attribute directory type: val (valid), inv (invalid), nul (not present) |
| 23 |
# b - imagepath attribute directory type: val (valid), inv (invalid), nul (not present) |
| 24 |
# c - expectation |
| 25 |
# d - name of output graph |
| 26 |
|
| 27 |
read a b c d |
| 28 |
|
| 29 |
#set image attribute directory |
| 30 |
case $a in |
| 31 |
"val") image="${image_dir}\/"; |
| 32 |
image_attr="valid absolute pathname";; |
| 33 |
"inv") image="${inv_dir}\/"; |
| 34 |
image_attr="invalid absolute pathname";; |
| 35 |
"nul") image=""; |
| 36 |
image_attr="null";; |
| 37 |
*) echo "Missing image attribute"; |
| 38 |
echo "Usage arg0 image imagepath expectation output_filename"; |
| 39 |
echo "image and imagepath valid values: val, inv, nul" |
| 40 |
echo "expectation - expected outcome message" |
| 41 |
echo "output_filename - defaults to test" |
| 42 |
exit 1;; |
| 43 |
esac |
| 44 |
|
| 45 |
#set imagepath attribute directory |
| 46 |
case $b in |
| 47 |
"val") imagepath="${imagepath_dir}\/"; |
| 48 |
imagepath_attr="valid absolute pathname";; |
| 49 |
"inv") imagepath="${inv_dir}\/"; |
| 50 |
imagepath_attr="invalid absolute pathname";; |
| 51 |
"nul") imagepath=""; |
| 52 |
imagepath_attr="null";; |
| 53 |
*) echo "Missing imagepath attribute"; |
| 54 |
echo "Usage arg0 image imagepath expectation output_filename"; |
| 55 |
echo "image and imagepath valid values: val, inv, nul" |
| 56 |
echo "expectation - expected outcome message" |
| 57 |
echo "output_filename - defaults to test" |
| 58 |
exit 1;; |
| 59 |
esac |
| 60 |
|
| 61 |
#set the expectation message that will be displayed on graph output |
| 62 |
case $c in |
| 63 |
"") echo "Missing expectation message"; |
| 64 |
echo "Usage arg0 image imagepath expectation output_filename"; |
| 65 |
echo "image and imagepath valid values: val, inv, nul" |
| 66 |
echo "expectation - expected outcome message" |
| 67 |
echo "output_filename - defaults to test" |
| 68 |
exit 1;; |
| 69 |
*) expect=$c;; |
| 70 |
esac |
| 71 |
|
| 72 |
|
| 73 |
#set the output graph filename |
| 74 |
case $d in |
| 75 |
"") outfile="test";; |
| 76 |
*) outfile=$d;; |
| 77 |
esac |
| 78 |
|
| 79 |
echo |
| 80 |
echo "case: ${a}_${b}" |
| 81 |
echo "image attribute: ${image_attr}" |
| 82 |
echo "imagepath attribute: ${imagepath_attr}" |
| 83 |
|
| 84 |
#base.gv is a template for the graph being created |
| 85 |
#construct the graph file and store in ../graphs |
| 86 |
#space characters must be converted to '^' characters to not confuse sed |
| 87 |
#restore '^' character to space before outputting the graph |
| 88 |
|
| 89 |
config="<TR><TD ALIGN=\"left\"><FONT POINT-SIZE=\"30.0\" FACE=\"Helvetica-Bold\">image attribute \(${image_attr}\)<\/FONT><\/TD><\/TR><TR><TD ALIGN=\"left\"><FONT POINT-SIZE=\"30.0\" FACE=\"Helvetica-Bold\">imagepath attribute \(${imagepath_attr}\)<\/FONT><\/TD><\/TR>" |
| 90 |
config=`echo -n $config | tr ' ' '^'` |
| 91 |
expect=`echo -n $expect | tr ' ' '^'` |
| 92 |
sed -e s/image_attr/image\=\"${image}image.jpg\",labelloc=b/ \ |
| 93 |
-e s/expect/${expect}/ \ |
| 94 |
-e s/config/${config}/ \ |
| 95 |
-e s/imagepath_attr/imagepath\=\"${imagepath}\"/ base.gv | tr '^' ' ' > ../graphs/${outfile}.gv |
| 96 |
|
| 97 |
#place the image file into the nshare directory |
| 98 |
dot -Tpng -o ../nshare/${outfile}_dot.png ../graphs/${outfile}.gv |
| 99 |
|
| 100 |
|