Send Linux-ha-cvs mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."
Today's Topics:
1. Linux-HA CVS: crm by andrew from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Wed, 21 Jun 2006 02:31:28 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: crm by andrew from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : andrew
Host :
Project : linux-ha
Module : crm
Dir : linux-ha/crm/pengine
Modified Files:
ptest.c regression.core.sh regression.sh
Log Message:
Cleaner regression test output
Detect and report memory leaks and invalid transitions in regression results
Bring a couple more testcases up-to-date
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/ptest.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -3 -r1.77 -r1.78
--- ptest.c 8 Jun 2006 13:39:10 -0000 1.77
+++ ptest.c 21 Jun 2006 08:31:27 -0000 1.78
@@ -1,4 +1,4 @@
-/* $Id: ptest.c,v 1.77 2006/06/08 13:39:10 andrew Exp $ */
+/* $Id: ptest.c,v 1.78 2006/06/21 08:31:27 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
@@ -36,7 +36,7 @@
#include <crm/cib.h>
-#define OPTARGS "V?X:D:G:I:Lwx"
+#define OPTARGS "V?X:D:G:I:Lwxd:"
#ifdef HAVE_GETOPT_H
# include <getopt.h>
@@ -51,6 +51,7 @@
extern crm_data_t * do_calculations(
pe_working_set_t *data_set, crm_data_t *xml_input, ha_time_t *now);
extern void cleanup_calculations(pe_working_set_t *data_set);
+char *use_date = NULL;
FILE *dot_strm = NULL;
#define DOT_PREFIX "PE_DOT: "
@@ -132,9 +133,9 @@
int
main(int argc, char **argv)
{
+ gboolean all_good = TRUE;
enum transition_status graph_rc = -1;
crm_graph_t *transition = NULL;
- const char *fake_now = NULL;
ha_time_t *a_date = NULL;
cib_t * cib_conn = NULL;
@@ -204,6 +205,9 @@
case 'X':
xml_file = crm_strdup(optarg);
break;
+ case 'd':
+ use_date = crm_strdup(optarg);
+ break;
case 'D':
dot_file = crm_strdup(optarg);
break;
@@ -287,7 +291,11 @@
crm_notice("Required feature set: %s", feature_set(cib_object));
do_id_check(cib_object, NULL, FALSE, FALSE);
-
+ if(!validate_with_dtd(cib_object,FALSE,HA_LIBDIR"/heartbeat/crm.dtd")) {
+ crm_crit("%s is not a valid configuration",
xml_file?xml_file:"stding");
+ all_good = FALSE;
+ }
+
if(input_file != NULL) {
FILE *input_strm = fopen(input_file, "w");
msg_buffer = dump_xml_formatted(cib_object);
@@ -299,16 +307,12 @@
crm_zero_mem_stats(NULL);
- fake_now = crm_element_value(cib_object, "fake_now");
- if(fake_now != NULL) {
- char *fake_now_copy = crm_strdup(fake_now);
- char *fake_now_mutable = fake_now_copy;
- a_date = parse_date(&fake_now_mutable);
+ if(use_date != NULL) {
+ a_date = parse_date(&use_date);
log_date(LOG_WARNING, "Set fake 'now' to",
a_date, ha_log_date|ha_log_time);
log_date(LOG_WARNING, "Set fake 'now' to (localtime)",
a_date, ha_log_date|ha_log_time|ha_log_local);
- crm_free(fake_now_copy);
}
do_calculations(&data_set, cib_object, a_date);
@@ -403,8 +407,8 @@
destroy_graph(transition);
crm_mem_stats(NULL);
- CRM_CHECK(crm_mem_stats(NULL) == FALSE, crm_err("Memory leak
detected"));
- CRM_CHECK(graph_rc == transition_complete, crm_err("An invalid
transition was produced"));
+ CRM_CHECK(crm_mem_stats(NULL) == FALSE, all_good = FALSE;
crm_err("Memory leak detected"));
+ CRM_CHECK(graph_rc == transition_complete, all_good = FALSE;
crm_err("An invalid transition was produced"));
crm_free(cib_object);
@@ -418,6 +422,9 @@
GMainLoop* mainloop = g_main_new(FALSE);
g_main_run(mainloop);
}
-
- return 0;
+
+ if(all_good) {
+ return 0;
+ }
+ return 5;
}
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/regression.core.sh,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- regression.core.sh 16 Jun 2006 07:28:34 -0000 1.21
+++ regression.core.sh 21 Jun 2006 08:31:27 -0000 1.22
@@ -19,7 +19,7 @@
verbose=$1
io_dir=testcases
-diff_opts="--ignore-all-space -u"
+diff_opts="--ignore-all-space -u -N"
failed=.regression.failed.diff
# zero out the error log
> $failed
@@ -39,8 +39,8 @@
function do_test {
- base=$1;
- name=$2;
+ base=$1; shift
+ name=$1; shift
input=$io_dir/${base}.xml
output=$io_dir/${base}.pe.out
expected=$io_dir/${base}.exp
@@ -52,38 +52,40 @@
if [ ! -f $input ]; then
echo "Test $name ($base)... Error (PE : input)";
+ num_failed=`expr $num_failed + 1`
return;
fi
+ echo "Test $base : $name";
if [ "$create_mode" != "true" -a ! -f $expected ]; then
- echo "Test $name ($base)... Error (PE : expected)";
+ echo " Error (PE : expected)";
# return;
fi
# ../admin/crm_verify -X $input
- ptest -V -X $input -D $dot_output -G $output
+ ptest -V -X $input -D $dot_output -G $output $*
+ if [ $? != 0 ]; then
+ echo " * Failed (PE : rc)";
+ num_failed=`expr $num_failed + 1`
+ fi
if [ -s core ]; then
- echo "Test $name ($base)... Moved core to core.${base}";
+ echo " Moved core to core.${base}";
+ num_failed=`expr $num_failed + 1`
rm -f core.$base
mv core core.$base
- return;
fi
if [ ! -s $output ]; then
- echo "Test $name ($base)... Error (PE : raw output)";
+ echo " Error (PE : no graph)";
+ num_failed=`expr $num_failed + 1`
rm $output
return;
fi
if [ ! -s $dot_output ]; then
- echo "Test $name ($base)... Error (PE : dot output)";
- rm $output
- return;
- fi
-
- if [ ! -s $output ]; then
- echo "Test $name ($base)... Error (PE : fixed output)";
+ echo " Error (PE : no dot-file)";
+ num_failed=`expr $num_failed + 1`
rm $output
return;
fi
@@ -91,51 +93,29 @@
if [ "$create_mode" = "true" ]; then
cp "$output" "$expected"
cp "$dot_output" "$dot_expected"
+ echo " Created expected output (PE)"
fi
- rc=2
- #dot -Tpng $dot_output 2>/dev/null > $dot_png
- if [ -f $dot_expected ]; then
- diff $diff_opts $dot_expected $dot_output >/dev/null
- rc=$?
- if [ $rc != 0 ]; then
- echo "Test $name ($base)... * Failed (PE : dot)";
- diff $diff_opts $dot_expected $dot_output 2>/dev/null >> $failed
- num_failed=`expr $num_failed + 1`
- else
- rm $dot_output
- fi
- else
- echo "Test $name ($base)... * No expected dot output";
- echo "==== Raw results for PE test ($base) ====" >> $failed
- cat $dot_output 2>/dev/null >> $failed
+ diff $diff_opts $dot_expected $dot_output >/dev/null
+ rc=$?
+ if [ $rc != 0 ]; then
+ echo " * Failed (PE : dot)";
+ diff $diff_opts $dot_expected $dot_output 2>/dev/null >> $failed
+ num_failed=`expr $num_failed + 1`
+ else
rm $dot_output
fi
- rc2=2
- if [ -f $expected ]; then
- diff $diff_opts $expected $output >/dev/null
- rc2=$?
- if [ $rc2 != 0 ]; then
- echo "Test $name ($base)... * Failed (PE : raw)";
- diff $diff_opts $expected $output 2>/dev/null >> $failed
- num_failed=`expr $num_failed + 1`
- else
- rm $output
- fi
- else
- echo "Test $name ($base)... * No expected raw output";
- echo "==== Raw results for PE test ($base) ====" >> $failed
- cat $output 2>/dev/null >> $failed
+ diff $diff_opts $expected $output >/dev/null
+ rc2=$?
+ if [ $rc2 != 0 ]; then
+ echo " * Failed (PE : raw)";
+ diff $diff_opts $expected $output 2>/dev/null >> $failed
+ num_failed=`expr $num_failed + 1`
+ else
rm $output
fi
- if [ "$create_mode" = "true" ]; then
- echo "Test $name ($base)... Created expected output (PE)"
- elif [ "$rc" = 0 -a "$rc2" = 0 ]; then
- echo "Test $name ($base)... Passed (PE)";
- fi
-
if [ "$test_te" = "true" ]; then
../tengine/ttest -X $output 2> $te_output
@@ -155,7 +135,7 @@
echo "==== Raw results for TE test ($base) ====" >> $failed
cat $te_output 2>/dev/null >> $failed
elif [ "$rc" = 0 ]; then
- echo "Test $name ($base)... Passed (TE)";
+ :
elif [ "$rc" = 1 ]; then
echo "Test $name ($base)... * Failed (TE)";
diff $diff_opts $te_expected $te_output 2>/dev/null >> $failed
@@ -169,27 +149,20 @@
rm -f $output $te_output
}
-
-#function do_test {
-# base=$1;
-# input=$io_dir/${base}.xml
-# expected=$io_dir/${base}.exp
-# te_expected=$io_dir/${base}.te.exp
-# mv $input $expected $te_expected testcases.saved
-#}
-
function test_results {
-
- if [ -s $failed ]; then
- if [ "$verbose" = "-v" ]; then
- echo "Results of $num_failed failed tests...."
- less $failed
+ if [ $num_failed != 0 ]; then
+ if [ -s $failed ]; then
+ if [ "$verbose" = "-v" ]; then
+ echo "Results of $num_failed failed tests...."
+ less $failed
+ else
+ echo "Results of $num_failed failed tests are in $failed...."
+ echo "Use $0 -v to display them automatically."
+ fi
else
- echo "Results of $num_failed failed tests are in $failed...."
- echo "Use $0 -v to display them automatically."
+ echo "$num_failed tests failed (no diff results)"
+ rm $failed
fi
- else
- rm $failed
fi
}
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/regression.sh,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -3 -r1.87 -r1.88
--- regression.sh 19 Jun 2006 10:47:31 -0000 1.87
+++ regression.sh 21 Jun 2006 08:31:27 -0000 1.88
@@ -42,19 +42,23 @@
do_test simple8 "Stickiness"
echo ""
-do_test date-1 "Dates"
-do_test standby "Standby"
-do_test comments "Comments"
do_test params-0 "Params: No change"
do_test params-1 "Params: Changed"
do_test params-2 "Params: Resource definition"
+
+echo ""
do_test orphan-0 "Orphan ignore"
do_test orphan-1 "Orphan stop"
-do_test probe-0 "Probe (anon clone)"
+echo ""
do_test target-0 "Target Role : baseline"
do_test target-1 "Target Role : test"
+echo ""
+do_test date-1 "Dates" -d "2005-020"
+do_test probe-0 "Probe (anon clone)"
+do_test standby "Standby"
+do_test comments "Comments"
echo ""
do_test master-0 "Stopped -> Slave"
@@ -209,13 +213,5 @@
do_test unrunnable-1 "Unrunnable"
echo ""
-do_test bad1 "Bad node "
-do_test bad2 "Bad rsc "
-do_test bad3 "No rsc class "
-do_test bad4 "Bad data "
-do_test bad5 "Bad data "
-do_test bad6 "Bad lrm_rsc "
-
-echo ""
test_results
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 31, Issue 69
********************************************