diff --git a/.gitattributes b/.gitattributes
index 15a788ad657c648a0aaa0048b501551ee73630f3..50e68f8c3581c5c2aaafe40890eeb490b468d29c 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -930,6 +930,8 @@ tools/bed.sh -text
 tools/bed_blackbox.sh -text
 tools/bed_manual.sh -text
 tools/cfar.sh -text
+tools/cfar_configs/cfar_partProbNog_probNol_probNoh_probNos_probBilr_probP1_probHeaprand_zipr.sh -text
+tools/cfar_configs/cfar_partStructNog_structNol_structNoh_structNos_structNoc_structP1Canaries_probHeaprand_zipr.sh -text
 tools/cfar_configs/cfar_probBilr_libtwitcher_zipr.sh -text
 tools/cfar_configs/cfar_probBilr_probHeaprand_zipr.sh -text
 tools/cfar_configs/cfar_probBilr_probNoh_zipr.sh -text
@@ -958,8 +960,6 @@ tools/cfar_configs/cfar_probNog_phase1_zipr.sh -text
 tools/cfar_configs/cfar_probNog_probBilr_zipr.sh -text
 tools/cfar_configs/cfar_probNog_probNol_probNoh_probNos_probBilr_probP1_probHeaprand_zipr.sh -text
 tools/cfar_configs/cfar_probNog_probSS_phase1_zipr.sh -text
-tools/cfar_configs/cfar_probNog_probSS_probDSX_phase1_zipr.sh -text
-tools/cfar_configs/cfar_probNog_probSS_probDSX_probSI_phase1_zipr.sh -text
 tools/cfar_configs/cfar_probNog_probSS_probDS_phase1_zipr.sh -text
 tools/cfar_configs/cfar_probNog_probSS_probSI_phase1_zipr.sh -text
 tools/cfar_configs/cfar_probNoh_probIlr_probP1_probHeaprand_probNos_strata.sh -text
@@ -995,8 +995,6 @@ tools/cfar_configs/cfar_structNogOF_phase1_zipr.sh -text
 tools/cfar_configs/cfar_structNogOF_probHeaprand_zipr.sh -text
 tools/cfar_configs/cfar_structNogOF_structSS_phase1_zipr.sh -text
 tools/cfar_configs/cfar_structNogOF_structSS_probDS_phase1_zipr.sh -text
-tools/cfar_configs/cfar_structNogOF_structSS_structDSX_phase1_zipr.sh -text
-tools/cfar_configs/cfar_structNogOF_structSS_structDSX_structSI_phase1_zipr.sh -text
 tools/cfar_configs/cfar_structNogOF_structSS_structDS_phase1_zipr.sh -text
 tools/cfar_configs/cfar_structNogOF_structSS_structSI_phase1_zipr.sh -text
 tools/cfar_configs/cfar_structNogOF_zipr.sh -text
diff --git a/tools/cfar.sh b/tools/cfar.sh
index 701004a19041f338046250bfb7f3b3ab5bb077ba..35abd2b2c09905d50c7d719d572b9c1684ae9cd0 100755
--- a/tools/cfar.sh
+++ b/tools/cfar.sh
@@ -31,6 +31,7 @@ structured_nog=0
 structured_nos=0
 structured_ds=0
 structured_stack_init=0   # auto stack initialize
+assurance_case_evidence=1 	# for gathering assurance case evidence
 config_name="unspecified"
 backend="strata"
 
@@ -87,6 +88,9 @@ do
 			echo "Unknown backend: ${cmd_line_options[$(expr $seq + 1)]}"
 			exit 1
 		fi
+	# this option is for cfar.  It should always be last so that all the log files for every step can be parsed
+	elif [ "$i" == "--gather_assurance" ]; then 	
+		assurance_case_evidence=1 
 	else
 		new_cmd_line_options+=("$i")
 	fi
@@ -179,6 +183,14 @@ do
 		fi
 	fi
 
+	# options to turn on assurance case evidence gathering
+	# This has to be here because per_variant options come last in the PS commandline
+	# And we need assurance case evidence to be LAST ps_analyze step executed
+	if [ "$assurance_case_evidence" -eq 1 ]; then
+		per_variant_options+=(--step assurance_case_evidence=on)
+	fi
+
+
 	# add in options for output directory.
 	per_variant_options+=(--tempdir "$baseoutdir/v${seq}/peasoup_executable_dir")
 	mkdir -p "$baseoutdir/v${seq}"
diff --git a/tools/cfar_configs/cfar_partProbNog_probNol_probNoh_probNos_probBilr_probP1_probHeaprand_zipr.sh b/tools/cfar_configs/cfar_partProbNog_probNol_probNoh_probNos_probBilr_probP1_probHeaprand_zipr.sh
new file mode 100755
index 0000000000000000000000000000000000000000..c62b75136c7b537313875b4928e211596597898e
--- /dev/null
+++ b/tools/cfar_configs/cfar_partProbNog_probNol_probNoh_probNos_probBilr_probP1_probHeaprand_zipr.sh
@@ -0,0 +1,12 @@
+#!/bin/bash 
+
+source $(dirname $0)/../ps_wrapper.source $0
+
+
+
+file $2|grep "ELF 64-bit LSB  executable" > /dev/null
+if [ $? = 0 ]; then
+	$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --step-option zipr:"--large_only:nog_on true" --step diehard=on --step noh=on --step nol=on --step-option move_globals:-d --step-option move_globals:.interp
+else
+	$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step diehard=on --step noh=on --step nol=on --step-option move_globals:-d --step-option move_globals:.interp
+fi
diff --git a/tools/cfar_configs/cfar_partStructNog_structNol_structNoh_structNos_structNoc_structP1Canaries_probHeaprand_zipr.sh b/tools/cfar_configs/cfar_partStructNog_structNol_structNoh_structNos_structNoc_structP1Canaries_probHeaprand_zipr.sh
new file mode 100755
index 0000000000000000000000000000000000000000..f63490618ce663a6aeec4a4ca6db3003d18a736b
--- /dev/null
+++ b/tools/cfar_configs/cfar_partStructNog_structNol_structNoh_structNos_structNoc_structP1Canaries_probHeaprand_zipr.sh
@@ -0,0 +1,10 @@
+#!/bin/bash 
+source $(dirname $0)/../ps_wrapper.source $0
+
+
+file $2|grep "ELF 64-bit LSB  executable" > /dev/null
+if [ $? = 0 ]; then
+	$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true" --step diehard=on --step noh=on --step nol=on --step-option move_globals:-d --step-option move_globals:.interp
+else
+	$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step diehard=on --step noh=on --step nol=on --step-option move_globals:-d --step-option move_globals:.interp
+fi
diff --git a/tools/cfar_configs/cfar_probNog_phase1_zipr.sh b/tools/cfar_configs/cfar_probNog_phase1_zipr.sh
index 5aca6c8a3fb48939ff8f1ee5c40e79287873ee5e..69fc2b9b8c0fb4dc44baed34485ac3df033cd5a8 100755
--- a/tools/cfar_configs/cfar_probNog_phase1_zipr.sh
+++ b/tools/cfar_configs/cfar_probNog_phase1_zipr.sh
@@ -2,5 +2,5 @@
 source $(dirname $0)/../ps_wrapper.source $0
 
 
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --step-option zipr:"--large_only:nog_on true" --step noh=on --step nol=on --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive
+$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --step-option zipr:"--large_only:nog_on true" --step noh=on --step nol=on --step-option move_globals:-d --step-option move_globals:.interp
 
diff --git a/tools/cfar_configs/cfar_probNog_probSS_phase1_zipr.sh b/tools/cfar_configs/cfar_probNog_probSS_phase1_zipr.sh
index cb852cd2e1aee82912df5189d353478ff07d5f66..29cb60a05c9d46c0cfa2f972f04a6a66870679a5 100755
--- a/tools/cfar_configs/cfar_probNog_probSS_phase1_zipr.sh
+++ b/tools/cfar_configs/cfar_probNog_probSS_phase1_zipr.sh
@@ -1,4 +1,4 @@
 #!/bin/bash 
 
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --step-option zipr:"--large_only:nog_on true" --step noh=on --step nol=on --step stack_stamp=on --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive
+$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --step-option zipr:"--large_only:nog_on true" --step noh=on --step nol=on --step stack_stamp=on --step-option move_globals:-d --step-option move_globals:.interp 
 
diff --git a/tools/cfar_configs/cfar_probNog_probSS_probDSX_phase1_zipr.sh b/tools/cfar_configs/cfar_probNog_probSS_probDSX_phase1_zipr.sh
deleted file mode 100755
index 7080b20f2f8ac49cefb552bf150fd7725e6c3f4d..0000000000000000000000000000000000000000
--- a/tools/cfar_configs/cfar_probNog_probSS_probDSX_phase1_zipr.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash 
-source $(dirname $0)/../ps_wrapper.source $0
-
-
-#
-# The calling script is responsible for setting up the options for duck_season
-#    --json 
-#    --imagename
-#    [ --xor ]
-#
-
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step p1transform=on --step duck_season=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --step-option zipr:"--large_only:nog_on true" --step noh=on --step nol=on --step stack_stamp=on  --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive --step-option duck_season:--xor
diff --git a/tools/cfar_configs/cfar_probNog_probSS_probDSX_probSI_phase1_zipr.sh b/tools/cfar_configs/cfar_probNog_probSS_probDSX_probSI_phase1_zipr.sh
deleted file mode 100755
index b856525f292a54c5fa6697588be5647ef6a93981..0000000000000000000000000000000000000000
--- a/tools/cfar_configs/cfar_probNog_probSS_probDSX_probSI_phase1_zipr.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash 
-source $(dirname $0)/../ps_wrapper.source $0
-
-
-#
-# The calling script is responsible for setting up the options for duck_season
-#    --json 
-#    --imagename
-#    [ --xor ]
-#
-
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step p1transform=on --step duck_season=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step initialize_stack=on --step-option initialize_stack:"--initvalue $$" --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --step-option zipr:"--large_only:nog_on true" --step noh=on --step nol=on --step stack_stamp=on  --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive --step-option duck_season:--xor 
diff --git a/tools/cfar_configs/cfar_probNog_probSS_probDS_phase1_zipr.sh b/tools/cfar_configs/cfar_probNog_probSS_probDS_phase1_zipr.sh
index 98a6f6021df1b32dcfc6ff21f33bb6431d47f52b..1d2de7ad24eed7084931a2f6fbb84207185ca0ad 100755
--- a/tools/cfar_configs/cfar_probNog_probSS_probDS_phase1_zipr.sh
+++ b/tools/cfar_configs/cfar_probNog_probSS_probDS_phase1_zipr.sh
@@ -8,5 +8,5 @@ source $(dirname $0)/../ps_wrapper.source $0
 #    --imagename
 #
 
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step p1transform=on --step duck_season=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --step-option zipr:"--large_only:nog_on true" --step noh=on --step nol=on --step stack_stamp=on  --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive
+$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step p1transform=on --step duck_season=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --step-option zipr:"--large_only:nog_on true" --step noh=on --step nol=on --step stack_stamp=on  --step-option move_globals:-d --step-option move_globals:.interp
 
diff --git a/tools/cfar_configs/cfar_structNogOF_phase1_zipr.sh b/tools/cfar_configs/cfar_structNogOF_phase1_zipr.sh
index 0ea6339d4b80549239a58d0f6080e61704801dec..420e910f2921bf8ec8e125f1ace6923d9a925b53 100755
--- a/tools/cfar_configs/cfar_structNogOF_phase1_zipr.sh
+++ b/tools/cfar_configs/cfar_structNogOF_phase1_zipr.sh
@@ -2,5 +2,5 @@
 source $(dirname $0)/../ps_wrapper.source $0
 
 
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true --large_only:overflow_protection true" --step noh=on --step nol=on --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive
+$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true --large_only:overflow_protection true" --step noh=on --step nol=on --step-option move_globals:-d --step-option move_globals:.interp
 
diff --git a/tools/cfar_configs/cfar_structNogOF_structSS_phase1_zipr.sh b/tools/cfar_configs/cfar_structNogOF_structSS_phase1_zipr.sh
index fb5446a74503cc07f3b49400fc223d4cec9ac474..4b2fa910b5788d0add9a66e77830c2e3658c92af 100755
--- a/tools/cfar_configs/cfar_structNogOF_structSS_phase1_zipr.sh
+++ b/tools/cfar_configs/cfar_structNogOF_structSS_phase1_zipr.sh
@@ -2,5 +2,5 @@
 source $(dirname $0)/../ps_wrapper.source $0
 
 
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true --large_only:overflow_protection true" --step noh=on --step nol=on --step stack_stamp=on --structured_stack_stamp --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive
+$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true --large_only:overflow_protection true" --step noh=on --step nol=on --step stack_stamp=on --structured_stack_stamp --step-option move_globals:-d --step-option move_globals:.interp 
 
diff --git a/tools/cfar_configs/cfar_structNogOF_structSS_probDS_phase1_zipr.sh b/tools/cfar_configs/cfar_structNogOF_structSS_probDS_phase1_zipr.sh
index a48340747cc24106994239e58838699dae266cca..93b9143e67c3bb5cadf25289a546831d19fed8e5 100755
--- a/tools/cfar_configs/cfar_structNogOF_structSS_probDS_phase1_zipr.sh
+++ b/tools/cfar_configs/cfar_structNogOF_structSS_probDS_phase1_zipr.sh
@@ -2,5 +2,5 @@
 source $(dirname $0)/../ps_wrapper.source $0
 
 
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step duck_season=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true --large_only:overflow_protection true" --step noh=on --step nol=on --step stack_stamp=on --structured_stack_stamp --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive
+$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step duck_season=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true --large_only:overflow_protection true" --step noh=on --step nol=on --step stack_stamp=on --structured_stack_stamp --step-option move_globals:-d --step-option move_globals:.interp
 
diff --git a/tools/cfar_configs/cfar_structNogOF_structSS_structDSX_phase1_zipr.sh b/tools/cfar_configs/cfar_structNogOF_structSS_structDSX_phase1_zipr.sh
deleted file mode 100755
index fb24c0d58354aec8e22049aa545ad280fe9e3cbe..0000000000000000000000000000000000000000
--- a/tools/cfar_configs/cfar_structNogOF_structSS_structDSX_phase1_zipr.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash 
-source $(dirname $0)/../ps_wrapper.source $0
-
-
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step duck_season=on --structured_ds --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true --large_only:overflow_protection true" --step noh=on --step nol=on --step stack_stamp=on --structured_stack_stamp --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive --step-option duck_season:--xor
-
diff --git a/tools/cfar_configs/cfar_structNogOF_structSS_structDSX_structSI_phase1_zipr.sh b/tools/cfar_configs/cfar_structNogOF_structSS_structDSX_structSI_phase1_zipr.sh
deleted file mode 100755
index 11278dccd7e2a4fab1560320350ea5a871746f37..0000000000000000000000000000000000000000
--- a/tools/cfar_configs/cfar_structNogOF_structSS_structDSX_structSI_phase1_zipr.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash 
-source $(dirname $0)/../ps_wrapper.source $0
-
-
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step duck_season=on --step initialize_stack=on --structured_stack_init --structured_ds --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true --large_only:overflow_protection true" --step noh=on --step nol=on --step stack_stamp=on --structured_stack_stamp --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive --step-option duck_season:--xor 
-
diff --git a/tools/cfar_configs/cfar_structNogOF_structSS_structDS_phase1_zipr.sh b/tools/cfar_configs/cfar_structNogOF_structSS_structDS_phase1_zipr.sh
index 3e5b3caf36342f49b541db4011866260b8a7a471..74063424b8062d02ea0cc878c1641fc6166c398d 100755
--- a/tools/cfar_configs/cfar_structNogOF_structSS_structDS_phase1_zipr.sh
+++ b/tools/cfar_configs/cfar_structNogOF_structSS_structDS_phase1_zipr.sh
@@ -2,5 +2,5 @@
 source $(dirname $0)/../ps_wrapper.source $0
 
 
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step duck_season=on --structured_ds --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true --large_only:overflow_protection true" --step noh=on --step nol=on --step stack_stamp=on --structured_stack_stamp --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive
+$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step duck_season=on --structured_ds --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true --large_only:overflow_protection true" --step noh=on --step nol=on --step stack_stamp=on --structured_stack_stamp --step-option move_globals:-d --step-option move_globals:.interp 
 
diff --git a/tools/cfar_configs/cfar_structNog_phase1_zipr.sh b/tools/cfar_configs/cfar_structNog_phase1_zipr.sh
index 99502534cdb0813b62f5354a53b020e12977004e..eec2dae7608ce088d3a2f1084fddebfec56ecec5 100755
--- a/tools/cfar_configs/cfar_structNog_phase1_zipr.sh
+++ b/tools/cfar_configs/cfar_structNog_phase1_zipr.sh
@@ -2,4 +2,4 @@
 source $(dirname $0)/../ps_wrapper.source $0
 
 
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true" --step noh=on --step nol=on --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive
+$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true" --step noh=on --step nol=on --step-option move_globals:-d --step-option move_globals:.interp
diff --git a/tools/cfar_configs/cfar_structNog_structSS_phase1_zipr.sh b/tools/cfar_configs/cfar_structNog_structSS_phase1_zipr.sh
index df361fcd976e7622781ee34877a429654e576502..533a59e041addb37d2204fd727ee60cd77b4ee23 100755
--- a/tools/cfar_configs/cfar_structNog_structSS_phase1_zipr.sh
+++ b/tools/cfar_configs/cfar_structNog_structSS_phase1_zipr.sh
@@ -2,5 +2,5 @@
 source $(dirname $0)/../ps_wrapper.source $0
 
 
-$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true " --step noh=on --step nol=on --step stack_stamp=on --structured_stack_stamp --step-option move_globals:-d --step-option move_globals:.interp --step-option move_globals:--aggressive
+$PEASOUP_HOME/tools/cfar.sh "$@" --backend zipr --step diehard=on --step-option zipr:"--zipr:seed $$" --structured_noc --structured_nos --step-option zipr:"--large_only:on true" --structured_p1_canaries  --step p1transform=on --step non_overlapping_stack=on --config_name $(basename $0 .sh|sed "s/cfar_//") --step move_globals=on --step set_interpreter=on --step-option set_interpreter:"--interp /target_apps/ld-nol.so" --structured_nog --step-option zipr:"--large_only:nog_on true " --step noh=on --step nol=on --step stack_stamp=on --structured_stack_stamp --step-option move_globals:-d --step-option move_globals:.interp
 
diff --git a/tools/cfar_configs/cr_chunk.json.template b/tools/cfar_configs/cr_chunk.json.template
index eb171d9455caebcea1a81cf0d8c46d1b13bcbfab..eb40b242b34f9853234b2ab8fa56441e259f0819 100644
--- a/tools/cfar_configs/cr_chunk.json.template
+++ b/tools/cfar_configs/cr_chunk.json.template
@@ -13,7 +13,7 @@
                 }
             },
             "dump": {
-                "top_dir": "/work_dir/images"
+                "top_dir": "/testing/results/images"
             },
             "monitor": {
 		<<PRECHECKPOINTCMD>>,
@@ -31,13 +31,13 @@
                         "--ext-unix-sk",
                         "-v4",
                         "--raven-files",
-                        "/work_dir/thttpd.log"
+                        "/testing/results/thttpd.log"
                     ],
                     "path": "/usr/sbin/criu"
                 }
             },
             "dump": {
-                "top_dir": "/work_dir/images"
+                "top_dir": "/testing/results/images"
             },
             "monitor": {
                 "exec": {
diff --git a/tools/generate_mvee_package.sh b/tools/generate_mvee_package.sh
index d181952ff72d1d680bae7bd3ebf077ab049e8f3e..2192b53d48a487a21311624268e82b5ef36df801 100755
--- a/tools/generate_mvee_package.sh
+++ b/tools/generate_mvee_package.sh
@@ -8,13 +8,14 @@ usage()
 
 	echo "
 Usage:
-	generate_mvee_config.sh 
+	generate_mvee_package.sh 
 
 	[(--include-cr|--noinclude-cr)]
 	[(--diehard|--nodiehard)]
 	[(--libtwitcher|--nolibtwitcher)]
 	[(--enablenoh|--disablenoh)]
 	[(--enablenol|--disablenol)]
+	[(--enable-assurance|--disable-assurance)]
 	--indir <path_to_variants>
 	--outdir <path_to_variants>
 	[--args <arguments string in json format> ]
@@ -39,6 +40,7 @@ check_opts()
 	use_libtwitcher="--nolibtwitcher"
 	use_noh="--disablenoh"
 	use_nol="--disablenol"
+	use_assurance="--disable-assurance"
 	use_includecr="--noinclude-cr"
 	mainexe_opt="" # look in target_apps and find exactly one thing.
 	verbose=0
@@ -58,6 +60,8 @@ check_opts()
 		   --long disablenoh
 		   --long enablenol
 		   --long disablenol
+		   --long enable-assurance
+		   --long disable-assurance
 		   --long include-cr
 		   --long noinclude-cr
                    --long indir:
@@ -77,7 +81,7 @@ check_opts()
         if [ `uname -s` = "SunOS" ]; then
                 TEMP=`getopt $short_opts "$@"`
         else
-                TEMP=`getopt -o $short_opts $long_opts -n 'generate_mvee_config.sh' -- "$@"`
+                TEMP=`getopt -o $short_opts $long_opts -n 'generate_mvee_package.sh' -- "$@"`
         fi
 
         # error check #
@@ -152,6 +156,10 @@ check_opts()
 				use_nol="$1"
 				shift 1
 			;;
+			--enable-assurance|--disable-assurance)
+				use_assurance="$1"
+				shift 1
+			;;
                         --)
                                 shift
                                 break
@@ -192,6 +200,7 @@ check_opts()
 		echo "Setting include-cr = $use_includecr"
 		echo "Setting noh = $use_noh"
 		echo "Setting nol = $use_nol"
+		echo "Setting assurance = $use_assurance"
 	fi
 
 	server=${server} # uppercase the server setting.
@@ -332,6 +341,230 @@ copy_stuff()
 
 }
 
+# gather_aggregate_assurance_evidence()
+# This function gathers and annotates all lines into an output file
+# This resulting output file will be parsed into human-readable format at a later step 
+gather_aggregate_assurance_evidence()
+{
+	# Inputs: 
+	# 	$1=input file 
+	#	$2=output file
+	# 	$3=variant_label (variant number 1,2,3, etc.)
+	#	$4=binary_name
+	input="$1"
+	output="$2"
+	variant_num="$3"
+	binary_name="$4"
+
+	echo -n "	Gathering aggregate assurance evidence for $binary_name, variant $variant_num ... "
+
+	if [ ! -f "$input" ]; then
+		echo "gather_aggregate_assurance_evidence(): $input FILE NOT FOUND."
+		return
+	fi
+
+	# find the AGGREGATE_ASSURANCE data
+	# 	1. find matching lines
+	#	2. add variant number information
+	transform_names=`grep AGGREGATE_ASSURANCE_ $input | sed "s/AGGREGATE_ASSURANCE_/${binary_name}::variant-${variant_num}::/g"`
+
+	# put the lines into the output file
+	for t in $transform_names
+	do
+		echo "$t" >> $output
+	done
+
+	echo "Done!"
+}
+
+# After aggregate assurance evidence is collected, parse it into human readable form
+parse_aggregate_assurance_file()
+{
+	# Inputs:
+	#	$1= input file containing unsorted aggregated annotated assurance case evidence
+	#		input file format is <binary_name>::<variantIdentifier>::<transformName>::<statEvidence>  
+	#
+	input=$1
+	output=$2
+	variant_set_label=$3
+
+
+	if [ ! -f "$input" ]; then
+		echo "parse_aggregate_assurance_file():  $input FILE NOT FOUND."
+		return
+	fi
+
+	echo -n "	Parsing aggregate assurance evidence for $variant_set_label ... "
+
+	# find the binary names
+	binary_names=`cat $input | awk 'BEGIN{FS="::"}{print $1}' | sort | uniq`
+
+	# for each binary 
+	for b in $binary_names
+	do
+		echo "Variant Set: $variant_set_label" >> $output
+		echo "Binary Name: $b" >> $output
+		echo >> $output
+
+
+		# find the transform names for this binary
+		transform_names=`cat $input |grep $b | awk 'BEGIN{FS="::"} {print $3}' |sort | uniq`
+
+		t_label=A
+		# for each transform
+		for t in $transform_names
+		do
+			echo -n "${t_label}. Transform Name: " >> $output
+			echo "$t" | sed 's/_/ /g' >> $output
+
+			# find the unique stat names 
+			# stat name with values is in 4th field
+			# so remove everything from = to EOL
+			stat_names=`grep "$b" $input | grep "$t" | awk 'BEGIN{FS="::"} {print $4}' | sed "s/=.*//g" | sort | uniq`
+
+			s_label=1
+			for s in $stat_names
+			do
+				echo -n -e "\t" >> $output
+				echo -n "${s_label}. " >> $output
+				# remove the underscores
+				echo "$s" | sed 's/_/ /g' >> $output
+		
+				# find the variant names
+				variant_names=`cat $input | grep $b | awk 'BEGIN{FS="::"} {print $2}' | sort | uniq`
+				v_label=a
+				for v in $variant_names
+				do
+					# find the stat for that variant
+					stat_val=`grep "$b" $input | grep "$t" | grep "$v" | grep "$s" |  awk 'BEGIN{FS="::"} {print $4}' | sed "s/${s}=//g"`
+					echo -e "\t\t${v_label}. ${v}: ${stat_val}" >> $output
+					# increment the t_label to the next value
+					# make use of the fact that perl can increment letters
+					v_label=$( perl -e '++$ARGV[0]; print $ARGV[0];' -- "$v_label" )
+				done
+				echo >> $output
+				# increment the t_label to the next value
+				# make use of the fact that perl can increment letters
+				s_label=$( perl -e '++$ARGV[0]; print $ARGV[0];' -- "$s_label" )
+			done
+			echo >> $output
+			# increment the t_label to the next value
+			# make use of the fact that perl can increment letters
+			t_label=$( perl -e '++$ARGV[0]; print $ARGV[0];' -- "$t_label" )
+		done	
+		echo >> $output
+	done
+
+	echo "Done!"
+}
+
+
+# parse assurance evidence into human readable format
+# $1 input file (assurance evidence)
+# $2 output file (vs-?_variant-?_evidence.txt)
+parse_assurance_file()
+{
+	input=$1
+	output=$2
+
+	if [ ! -f "$input" ]; then
+		echo "parse_assurance_file():  $input FILE NOT FOUND."
+		return
+	fi
+	
+
+	# find the part of the line that is the transform name, strip out the ASSURANCE_ tag 
+	# The space is important to distinguish between variant set AGGREGATE_ASSURANCE and 
+	# per_variant_ASSURANCE
+	transform_names=`grep [[:space:]]ASSURANCE_ $input | grep :: | sed 's/ASSURANCE_//g' | sed 's/^+.*//g'| sed 's/::.*//g' | uniq`
+
+	# count the number of different transform labels
+	j=0
+	for i in $transform_names
+	do
+        	j=`expr $j + 1`
+	done
+
+	# for each transform_name find the lines that match the transform, parse them,
+	# and place them in the output file
+	# simulate outline numbering using 1,2,3... and a,b,c...
+	count=1
+	for t in $transform_names
+	do
+		# Remove any underscores and replace with spaces to make more human-readable
+        	echo "${count}. Transform Name:  `echo $t | sed 's/_/ /g' `" >> $output
+
+		# The space is important to distinguish between variant set AGGREGATE_ASSURANCE and 
+		# per_variant_ASSURANCE
+        	matching_lines=`grep [[:space:]]ASSURANCE_ $input | grep :: | sed 's/^+.*//g' | grep $t`
+
+		# starting letter for labelling
+		letter=a
+        	for m in $matching_lines
+        	do
+                	echo -n -e "\t${letter}. " >> $output
+			# find the stats and print them in human-readable format
+			
+			# get rid of everything before ::
+			# change the = to :
+			# change the underscores to spaces
+                	echo $m | sed 's/^.*:://g' | sed 's/=/: /g' | sed 's/_/ /g'  >> $output
+			# "increment" the letter level
+			letter=$( perl -e '++$ARGV[0]; print $ARGV[0];' -- "$letter")
+        	done
+		# prettier formatting, add blank line
+		echo >> $output
+		# increment the counter level
+        	count=`expr $count + 1`
+	done	
+}
+
+# copy assurance evidence to the generated mvee package
+copy_assurance_evidence()
+{
+	# This should be the assurance_evidence log for the binary file
+	in=$1
+	# This should be the file whose name is vs-?_variant-?_evidence.txt
+	out=$2
+	#  This is the name of the binary
+	exe=$3
+	# is this the main binary?
+	is_main=$4
+	# name of the transformation configuration
+	transform_config_name=$5 
+	# identifier to print that identifies variant set and which variant
+	vs_identifier="$6"
+
+	echo -n "	Copying assurance evidence file for $exe ... "
+
+	# Don't do anything if there isn't a source file.
+	if [[ ! -f "$in" ]]; then
+		echo "No assurance case evidence found for $exe config: $transform_config_name."
+		return
+	fi
+
+	# We will assume that the main exe is handled first, so create the file if is_main is 1
+	if [[ $is_main == 1 ]] ; then
+		# copy to new file
+		echo "Binary Name: $exe" > $out
+		echo "Transforms configuration:  $transform_config_name" >> $out
+		echo >> $out
+		parse_assurance_file $in $out
+
+	else
+		# Append to existing file
+		echo "Binary Name: $exe" >> $out
+		echo "Transforms configuration:  $transform_config_name" >> $out
+		echo "Variant Identifier:  $vs_identifier" >> $out
+		echo >> $out
+		parse_assurance_file $in $out
+	fi
+
+	echo >> $out
+
+	echo "Done!"
+}
+
 
 
 finalize_json()
@@ -340,6 +573,10 @@ finalize_json()
 	mkdir -p $outdir
 	mkdir $outdir/global
 	mkdir $outdir/marshaling
+	# only create assurance directory if gathering assurance evidence
+	if [ "x"$use_assurance = "x--enable-assurance" ]; then
+		mkdir $outdir/assurance
+	fi
 
 	# copy jar, python, and bash scripts into package.
 	cp $CFAR_EMT_PLUGINS/*.jar $outdir/marshaling/
@@ -383,7 +620,7 @@ finalize_json()
 		# to hold the initial list for the variant set description.
 		vs_json_contents=" \"vs-$vs\" : [ <<VARIANT_LIST>> ]"
 
-		# for each varjiant in the variant set.
+		# for each variant in the variant set.
 		for seq in $(seq 1 $variants_per_vs )
 		do
 
@@ -460,9 +697,6 @@ finalize_json()
 				exit 4
 			fi
 
-			
-
-
 			# start with ps_dir
 			ps_dir=$(dirname $variant_json)
 
@@ -494,21 +728,25 @@ finalize_json()
 			# new_variant_dir_ts="/target_apps/vs-$vs/variant-$seq"
 			copy_stuff $full_exe_dir/peasoup_executable_dir $new_variant_dir/bin/peasoup_executable_dir $main_exe $new_variant_dir_ts/bin/peasoup_executable_dir 1
 				
+			if [ "x"$use_assurance = "x--enable-assurance" ]; then
+				# copy assurance evidence
+				copy_assurance_evidence $full_exe_dir/peasoup_executable_dir/logs/assurance_case_evidence.log  $outdir/assurance/vs-${vs}_variant-${seq}_evidence.txt $main_exe 1 $config "vs-${vs}_variant-${seq}"
 
+				# gather aggregate assurance evidence
+				gather_aggregate_assurance_evidence $full_exe_dir/peasoup_executable_dir/logs/assurance_case_evidence.log  "$outdir/assurance/vs-${vs}_aggregate_evidence.tmp.txt" $seq $main_exe 
+			fi
+			
 			# echo "exe_dir=$exe_dir"
 
 			# get the variant number for this config (e.g., get "v0" or "v1")
 			var_num_dir=$(basename $exe_dir)
 
-
-
 			# fill in any libraries that the variants should refer to
 			for lib in $libraries
 			do
 				# echo adding lib $lib
 				lib_dir="/vs-$vs/target_app_libs/dh-$lib/$config/$var_num_dir"
 
-
 				if [ "$main_exe" ==  "$lib" ]; then
 					#cp -R $indir/$lib_dir/peasoup_executable_dir $new_variant_dir/lib/peasoup_executable_dir.$lib.$config
 					mkdir -p $new_variant_dir/lib/peasoup_executable_dir.$lib.$config
@@ -529,6 +767,13 @@ finalize_json()
 					line=",  "$'\n\t\t\t'"  \"/usr/lib/$lib=$new_variant_dir_ts/lib/$lib\" "
 					copy_stuff $indir/$lib_dir/peasoup_executable_dir $new_variant_dir/lib/$lib-peasoup_executable_dir $lib $new_variant_dir_ts/lib/$lib-peasoup_executable_dir 0
 				fi
+				if [ "x"$use_assurance = "x--enable-assurance" ]; then
+					# copy assurance evidence
+					copy_assurance_evidence $indir/$lib_dir/peasoup_executable_dir/logs/assurance_case_evidence.log  $outdir/assurance/vs-${vs}_variant-${seq}_evidence.txt $lib 0 $config "vs-${vs}_variant-${seq}"
+					# gather aggregate assurance evidence
+					gather_aggregate_assurance_evidence $indir/$lib_dir/peasoup_executable_dir/logs/assurance_case_evidence.log  $outdir/assurance/vs-${vs}_aggregate_evidence.tmp.txt "$seq" $lib 
+
+				fi
 				variant_config_contents="${variant_config_contents//,<<LIBS>>/$line,<<LIBS>>}"
 		
 			done
@@ -589,6 +834,17 @@ finalize_json()
 			seq=$(expr $seq + 1)
 
 		done
+
+		if [ "x"$use_assurance = "x--enable-assurance" ]; then
+
+			# parse the aggregated assurance case evidence for the variant set
+			parse_aggregate_assurance_file "$outdir/assurance/vs-${vs}_aggregate_evidence.tmp.txt" "$outdir/assurance/vs-${vs}_aggregate_evidence.txt" "vs-${vs}"
+
+			# remove the intermediate file
+			rm -f "$outdir/assurance/vs-${vs}_aggregate_evidence.tmp.txt"
+		fi
+		
+
 		json_contents="${json_contents//<<VARIANT_SETS>>/$vs_json_contents,<<VARIANT_SETS>>}"
 	done