Changeset 2195
- Timestamp:
- 05/28/08 13:13:19
(6 months ago)
- Author:
- apatel
- Message:
Updated fnet test case to diff against generated fnet to expected output. Note that pass key and auth key are dynamic and have been excluded from the diff using regex.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
- Property svn:ignore set to
test.*
| r2185 |
r2195 |
|
| | 1 | Test should run without error. |
|---|
| 1 | 2 | Create in memory network data structure and then pass it to the FNetGenerator to produce the fnet file. |
|---|
| 2 | 3 | |
|---|
| r2185 |
r2195 |
|
| 4 | 4 | |
|---|
| 5 | 5 | RESULT=0 |
|---|
| 6 | | # LIBSELINUX needs to be passed in as the full path to libselinuxjava.so |
|---|
| | 6 | |
|---|
| | 7 | diff_fnet_files() |
|---|
| | 8 | { |
|---|
| | 9 | expected_output=$DIR/expected.fnet |
|---|
| | 10 | generated_output=$DIR/test.fnet |
|---|
| | 11 | diff_file=$DIR/test.diff |
|---|
| | 12 | `diff --ignore-matching-lines="networkresource guard_out {ipsec ( 3des.*" $expected_output $generated_output > $diff_file` |
|---|
| | 13 | if [ -e $diff_file ]; then |
|---|
| | 14 | different_lines=`wc -l $diff_file | cut -f 1 -d ' '` |
|---|
| | 15 | if [ $different_lines -gt 0 ]; then |
|---|
| | 16 | RESULT=1 |
|---|
| | 17 | fi; |
|---|
| | 18 | else |
|---|
| | 19 | RESULT=1 |
|---|
| | 20 | fi; |
|---|
| | 21 | } |
|---|
| 7 | 22 | |
|---|
| 8 | 23 | #run the compiler test |
|---|
| 9 | | java -cp build com.tresys.framework.compiler.Compiler -fnetgeneration $DIR/test.fnet -pc test/basepolicy/ -ds framework-plugin/resources/dictionary/dictionary.fdic -lib $LIBSELINUX > $DIR/test.out 2> $DIR/test.err |
|---|
| | 24 | java -cp build com.tresys.framework.compiler.Test -fnet $DIR/test.fnet > $DIR/test.out 2> $DIR/test.err |
|---|
| 10 | 25 | |
|---|
| 11 | 26 | |
|---|
| 12 | 27 | #check compiler error result |
|---|
| 13 | | #if [ $? -ne 1 ]; then |
|---|
| 14 | | # echo Unexpected error during compilation |
|---|
| 15 | | # RESULT=1 |
|---|
| 16 | | #fi; |
|---|
| | 28 | if [ $? -ne 0 ]; then |
|---|
| | 29 | echo Unexpected error during compilation |
|---|
| | 30 | RESULT=1 |
|---|
| | 31 | fi; |
|---|
| 17 | 32 | |
|---|
| 18 | 33 | |
|---|
| … | … | |
| 38 | 53 | RESULT=1 |
|---|
| 39 | 54 | fi; |
|---|
| | 55 | |
|---|
| | 56 | if [ $RESULT -ne 1 ]; then |
|---|
| | 57 | diff_fnet_files |
|---|
| | 58 | fi; |
|---|
| 40 | 59 | fi; |
|---|
| 41 | 60 | |
|---|
| … | … | |
| 45 | 64 | fi; |
|---|
| 46 | 65 | |
|---|
| | 66 | |
|---|
| | 67 | |
|---|
| | 68 | |
|---|
| 47 | 69 | return $RESULT |
|---|
| | 70 | |
|---|
Download in other formats:
* Generating other formats may take time.