diff --git a/tools/regression.exp b/tools/regression.exp index 7db6689f66..bda816a168 100755 --- a/tools/regression.exp +++ b/tools/regression.exp @@ -1,1132 +1,1212 @@ +Date: 2006-01-08 00:00:00Z +Date: 2006-W01-7 00:00:00Z +* Passed: iso8601 - 2006-W01-7 +Date: 2006-01-02 00:00:00Z +Date: 2006-W01-1 00:00:00Z +* Passed: iso8601 - 2006-W01-1 +Date: 2007-01-07 00:00:00Z +Date: 2007-W01-7 00:00:00Z +* Passed: iso8601 - 2007-W01-7 +Date: 2007-01-01 00:00:00Z +Date: 2007-W01-1 00:00:00Z +* Passed: iso8601 - 2007-W01-1 +Date: 2008-01-06 00:00:00Z +Date: 2008-W01-7 00:00:00Z +* Passed: iso8601 - 2008-W01-7 +Date: 2007-12-31 00:00:00Z +Date: 2008-W01-1 00:00:00Z +* Passed: iso8601 - 2008-W01-1 +Date: 2009-01-04 00:00:00Z +Date: 2009-W01-7 00:00:00Z +* Passed: iso8601 - 2009-W01-7 +Date: 2008-12-29 00:00:00Z +Date: 2009-W01-1 00:00:00Z +* Passed: iso8601 - 2009-W01-1 +Date: 2010-01-10 00:00:00Z +Date: 2010-W01-7 00:00:00Z +* Passed: iso8601 - 2010-W01-7 +Date: 2010-01-04 00:00:00Z +Date: 2010-W01-1 00:00:00Z +* Passed: iso8601 - 2010-W01-1 +Date: 2011-01-09 00:00:00Z +Date: 2011-W01-7 00:00:00Z +* Passed: iso8601 - 2011-W01-7 +Date: 2011-01-03 00:00:00Z +Date: 2011-W01-1 00:00:00Z +* Passed: iso8601 - 2011-W01-1 +Date: 2012-01-08 00:00:00Z +Date: 2012-W01-7 00:00:00Z +* Passed: iso8601 - 2012-W01-7 +Date: 2012-01-02 00:00:00Z +Date: 2012-W01-1 00:00:00Z +* Passed: iso8601 - 2012-W01-1 +Date: 2013-01-06 00:00:00Z +Date: 2013-W01-7 00:00:00Z +* Passed: iso8601 - 2013-W01-7 +Date: 2012-12-31 00:00:00Z +Date: 2013-W01-1 00:00:00Z +* Passed: iso8601 - 2013-W01-1 +Date: 2014-01-05 00:00:00Z +Date: 2014-W01-7 00:00:00Z +* Passed: iso8601 - 2014-W01-7 +Date: 2013-12-30 00:00:00Z +Date: 2014-W01-1 00:00:00Z +* Passed: iso8601 - 2014-W01-1 +Date: 2015-01-04 00:00:00Z +Date: 2015-W01-7 00:00:00Z +* Passed: iso8601 - 2015-W01-7 +Date: 2014-12-29 00:00:00Z +Date: 2015-W01-1 00:00:00Z +* Passed: iso8601 - 2015-W01-1 +Date: 2016-01-10 00:00:00Z +Date: 2016-W01-7 00:00:00Z +* Passed: iso8601 - 2016-W01-7 +Date: 2016-01-04 00:00:00Z +Date: 2016-W01-1 00:00:00Z +* Passed: iso8601 - 2016-W01-1 +Date: 2017-01-08 00:00:00Z +Date: 2017-W01-7 00:00:00Z +* Passed: iso8601 - 2017-W01-7 +Date: 2017-01-02 00:00:00Z +Date: 2017-W01-1 00:00:00Z +* Passed: iso8601 - 2017-W01-1 +Date: 2018-01-07 00:00:00Z +Date: 2018-W01-7 00:00:00Z +* Passed: iso8601 - 2018-W01-7 +Date: 2018-01-01 00:00:00Z +Date: 2018-W01-1 00:00:00Z +* Passed: iso8601 - 2018-W01-1 +Date: 2009-W53-7 00:00:00Z +* Passed: iso8601 - 2009-W53-07 Setting up shadow instance A new shadow instance was created. To begin using it paste the following into your shell: CIB_shadow=tools-regression ; export CIB_shadow The supplied command is considered dangerous. To prevent accidental destruction of the cluster, the --force flag is required in order to proceed. * Passed: cibadmin - Require --force for CIB erasure * Passed: cibadmin - Allow CIB erasure with --force * Passed: cibadmin - Query CIB * Passed: crm_attribute - Set cluster option * Passed: cibadmin - Query new cluster option * Passed: cibadmin - Query cluster options * Passed: cibadmin - Delete nvpair Call failed: Name not unique on network * Passed: cibadmin - Create operaton should fail with: -76, The object already exists * Passed: cibadmin - Modify cluster options section * Passed: cibadmin - Query updated cluster option * Passed: crm_attribute - Set duplicate cluster option Please choose from one of the matches above and suppy the 'id' with --attr-id * Passed: crm_attribute - Setting multiply defined cluster option should fail with -216, Could not set cluster option * Passed: crm_attribute - Set cluster option with -s Deleted crm_config option: id=(null) name=cluster-delay * Passed: crm_attribute - Delete cluster option with -i * Passed: cibadmin - Create node entry * Passed: cibadmin - Create node status entry * Passed: crm_attribute - Create node attribute * Passed: cibadmin - Query new node attribute Digest: * Passed: cibadmin - Digest calculation Call failed: Update was older than existing configuration * Passed: cibadmin - Replace operation should fail with: -45, Update was older than existing configuration Error performing operation: No such device or address scope=status name=standby value=off * Passed: crm_standby - Default standby value * Passed: crm_standby - Set standby status scope=nodes name=standby value=true * Passed: crm_standby - Query standby value Deleted nodes attribute: id=nodes-clusterNode-UUID-standby name=standby Could not establish attrd connection: Connection refused (111) Could not establish attrd connection: Connection refused (111) Could not establish attrd connection: Connection refused (111) Could not establish attrd connection: Connection refused (111) Could not establish attrd connection: Connection refused (111) * Passed: crm_standby - Delete standby value * Passed: cibadmin - Create a resource * Passed: crm_resource - Create a resource meta attribute false * Passed: crm_resource - Query a resource meta attribute Deleted dummy option: id=dummy-meta_attributes-is-managed name=is-managed * Passed: crm_resource - Remove a resource meta attribute * Passed: crm_resource - Create a resource attribute dummy (ocf::pacemaker:Dummy) Stopped * Passed: crm_resource - List the configured resources Could not establish attrd connection: Connection refused (111) Could not establish attrd connection: Connection refused (111) Could not establish attrd connection: Connection refused (111) Could not establish attrd connection: Connection refused (111) Could not establish attrd connection: Connection refused (111) * Passed: crm_resource - Set a resource's fail-count Resource dummy not moved: not-active and no preferred location specified. Error performing operation: Invalid argument * Passed: crm_resource - Require a destination when migrating a resource that is stopped Error performing operation: i.dont.exist is not a known node Error performing operation: No such device or address * Passed: crm_resource - Don't support migration to non-existant locations * Passed: crm_resource - Migrate a resource * Passed: crm_resource - Un-migrate a resource false * Passed: crm_ticket - Default ticket granted state * Passed: crm_ticket - Set ticket granted state false * Passed: crm_ticket - Query ticket granted state Deleted ticketA state attribute: name=granted * Passed: crm_ticket - Delete ticket granted state * Passed: crm_ticket - Make a ticket standby true * Passed: crm_ticket - Query ticket standby state * Passed: crm_ticket - Activate a ticket Deleted ticketA state attribute: name=standby * Passed: crm_ticket - Delete ticket standby state diff --git a/tools/regression.sh b/tools/regression.sh index 2b3fdaed36..d2265e1264 100755 --- a/tools/regression.sh +++ b/tools/regression.sh @@ -1,218 +1,240 @@ #!/bin/bash : ${shadow=tools-regression} test_home=`dirname $0` num_errors=0 num_passed=0 GREP_OPTIONS= function assert() { rc=$1; shift target=$1; shift app=$1; shift msg=$1; shift - exit_code=$1; shift + cib=$1; shift - cibadmin -Q + if [ x$cib = x0 ]; then + : nothing + else + cibadmin -Q + fi if [ $rc -ne $target ]; then num_errors=`expr $num_errors + 1` printf "* Failed (rc=%.3d): %-14s - %s\n" $rc $app "$msg" return exit 1 else printf "* Passed: %-14s - %s\n" $app "$msg" + printf "* Passed: %-14s - %s\n" $app "$msg" 1>&2 + num_passed=`expr $num_passed + 1` fi } function usage() { echo "Usage: ./regression.sh [-s(ave)] [-x] [-v(erbose)]" exit $1 } done=0 do_save=0 VALGRIND_CMD= while test "$done" = "0"; do case "$1" in -V|--verbose) verbose=1; shift;; -v|--valgrind) export G_SLICE=always-malloc VALGRIND_CMD="valgrind -q --show-reachable=no --leak-check=full --trace-children=no --time-stamp=yes --num-callers=20 --suppressions=$test_home/cli.supp" shift;; -x) set -x; shift;; -s) do_save=1; shift;; -p) PATH="$2:$PATH"; export PATH; shift 1;; -?) usage 0;; -*) echo "unknown option: $1"; usage 1;; *) done=1;; esac done if [ "x$VALGRIND_CMD" = "x" -a -x $test_home/crm_simulate ]; then echo "Using local binaries from: $test_home" PATH="$test_home:$PATH" fi function test_tools() { export CIB_shadow_dir=$test_home - $VALGRIND_CMD crm_shadow --batch --force --create-empty $shadow + $VALGRIND_CMD crm_shadow --batch --force --create-empty $shadow 2>&1 export CIB_shadow=$shadow - $VALGRIND_CMD cibadmin -Q + $VALGRIND_CMD cibadmin -Q 2>&1 - $VALGRIND_CMD cibadmin -E + $VALGRIND_CMD cibadmin -E 2>&1 assert $? 22 cibadmin "Require --force for CIB erasure" $VALGRIND_CMD cibadmin -E --force assert $? 0 cibadmin "Allow CIB erasure with --force" $VALGRIND_CMD cibadmin -Q > /tmp/$$.existing.xml assert $? 0 cibadmin "Query CIB" $VALGRIND_CMD crm_attribute -n cluster-delay -v 60s assert $? 0 crm_attribute "Set cluster option" $VALGRIND_CMD cibadmin -Q -o crm_config | grep cib-bootstrap-options-cluster-delay assert $? 0 cibadmin "Query new cluster option" $VALGRIND_CMD cibadmin -Q -o crm_config > /tmp/$$.opt.xml assert $? 0 cibadmin "Query cluster options" $VALGRIND_CMD cibadmin -D -o crm_config --xml-text '' assert $? 0 cibadmin "Delete nvpair" - $VALGRIND_CMD cibadmin -C -o crm_config --xml-file /tmp/$$.opt.xml + $VALGRIND_CMD cibadmin -C -o crm_config --xml-file /tmp/$$.opt.xml 2>&1 assert $? 76 cibadmin "Create operaton should fail with: -76, The object already exists" $VALGRIND_CMD cibadmin -M -o crm_config --xml-file /tmp/$$.opt.xml assert $? 0 cibadmin "Modify cluster options section" $VALGRIND_CMD cibadmin -Q -o crm_config | grep cib-bootstrap-options-cluster-delay assert $? 0 cibadmin "Query updated cluster option" $VALGRIND_CMD crm_attribute -n cluster-delay -v 40s -s duplicate assert $? 0 crm_attribute "Set duplicate cluster option" $VALGRIND_CMD crm_attribute -n cluster-delay -v 30s assert $? 234 crm_attribute "Setting multiply defined cluster option should fail with -216, Could not set cluster option" $VALGRIND_CMD crm_attribute -n cluster-delay -v 30s -s duplicate assert $? 0 crm_attribute "Set cluster option with -s" $VALGRIND_CMD crm_attribute -n cluster-delay -D -i cib-bootstrap-options-cluster-delay assert $? 0 crm_attribute "Delete cluster option with -i" $VALGRIND_CMD cibadmin -C -o nodes --xml-text '' assert $? 0 cibadmin "Create node entry" $VALGRIND_CMD cibadmin -C -o status --xml-text '' assert $? 0 cibadmin "Create node status entry" $VALGRIND_CMD crm_attribute -n ram -v 1024M -U clusterNode-UNAME -t nodes assert $? 0 crm_attribute "Create node attribute" $VALGRIND_CMD cibadmin -Q -o nodes | grep clusterNode-UUID-ram assert $? 0 cibadmin "Query new node attribute" $VALGRIND_CMD cibadmin -Q | cibadmin -5 -p 2>&1 > /dev/null assert $? 0 cibadmin "Digest calculation" # This update will fail because it has version numbers - $VALGRIND_CMD cibadmin -R --xml-file /tmp/$$.existing.xml + $VALGRIND_CMD cibadmin -R --xml-file /tmp/$$.existing.xml 2>&1 assert $? 237 cibadmin "Replace operation should fail with: -45, Update was older than existing configuration" crm_standby -N clusterNode-UNAME -G assert $? 0 crm_standby "Default standby value" crm_standby -N clusterNode-UNAME -v true assert $? 0 crm_standby "Set standby status" - crm_standby -N clusterNode-UNAME -G + crm_standby -N clusterNode-UNAME -G assert $? 0 crm_standby "Query standby value" - crm_standby -N clusterNode-UNAME -D + crm_standby -N clusterNode-UNAME -D 2>&1 assert $? 0 crm_standby "Delete standby value" $VALGRIND_CMD cibadmin -C -o resources --xml-text '' assert $? 0 cibadmin "Create a resource" $VALGRIND_CMD crm_resource -r dummy --meta -p is-managed -v false assert $? 0 crm_resource "Create a resource meta attribute" $VALGRIND_CMD crm_resource -r dummy --meta -g is-managed assert $? 0 crm_resource "Query a resource meta attribute" $VALGRIND_CMD crm_resource -r dummy --meta -d is-managed assert $? 0 crm_resource "Remove a resource meta attribute" $VALGRIND_CMD crm_resource -r dummy -p delay -v 10s assert $? 0 crm_resource "Create a resource attribute" $VALGRIND_CMD crm_resource -L assert $? 0 crm_resource "List the configured resources" - crm_failcount -r dummy -v 10 -N clusterNode-UNAME + crm_failcount -r dummy -v 10 -N clusterNode-UNAME 2>&1 assert $? 0 crm_resource "Set a resource's fail-count" - $VALGRIND_CMD crm_resource -r dummy -M + $VALGRIND_CMD crm_resource -r dummy -M 2>&1 assert $? 234 crm_resource "Require a destination when migrating a resource that is stopped" - $VALGRIND_CMD crm_resource -r dummy -M -N i.dont.exist + $VALGRIND_CMD crm_resource -r dummy -M -N i.dont.exist 2>&1 assert $? 250 crm_resource "Don't support migration to non-existant locations" $VALGRIND_CMD crm_resource -r dummy -M -N clusterNode-UNAME assert $? 0 crm_resource "Migrate a resource" $VALGRIND_CMD crm_resource -r dummy -U assert $? 0 crm_resource "Un-migrate a resource" $VALGRIND_CMD crm_ticket -t ticketA -G granted -d false assert $? 0 crm_ticket "Default ticket granted state" $VALGRIND_CMD crm_ticket -t ticketA -r --force assert $? 0 crm_ticket "Set ticket granted state" $VALGRIND_CMD crm_ticket -t ticketA -G granted assert $? 0 crm_ticket "Query ticket granted state" $VALGRIND_CMD crm_ticket -t ticketA -D granted --force assert $? 0 crm_ticket "Delete ticket granted state" $VALGRIND_CMD crm_ticket -t ticketA -s assert $? 0 crm_ticket "Make a ticket standby" $VALGRIND_CMD crm_ticket -t ticketA -G standby assert $? 0 crm_ticket "Query ticket standby state" $VALGRIND_CMD crm_ticket -t ticketA -a assert $? 0 crm_ticket "Activate a ticket" $VALGRIND_CMD crm_ticket -t ticketA -D standby assert $? 0 crm_ticket "Delete ticket standby state" } -test_tools &> $test_home/regression.out +function test_date() { +# $VALGRIND_CMD cibadmin -Q + for y in 06 07 08 09 10 11 12 13 14 15 16 17 18; do + $VALGRIND_CMD iso8601 -d "20$y-W01-7 00Z" + $VALGRIND_CMD iso8601 -d "20$y-W01-7 00Z" -W -E "20$y-W01-7 00:00:00Z" + assert $? 0 iso8601 "20$y-W01-7" 0 + $VALGRIND_CMD iso8601 -d "20$y-W01-1 00Z" + $VALGRIND_CMD iso8601 -d "20$y-W01-1 00Z" -W -E "20$y-W01-1 00:00:00Z" + assert $? 0 iso8601 "20$y-W01-1" 0 + done + + $VALGRIND_CMD iso8601 -d "2009-W53-7 00:00:00Z" -W -E "2009-W53-7 00:00:00Z" + assert $? 0 iso8601 "2009-W53-07" 0 + } + +test_date > $test_home/regression.out +test_tools >> $test_home/regression.out sed -i.sed 's/cib-last-written.*>/>/' $test_home/regression.out if [ $do_save = 1 ]; then cp $test_home/regression.out $test_home/regression.exp fi grep -e "^*" $test_home/regression.out if [ $num_errors != 0 ]; then echo $num_errors tests failed diff -u $test_home/regression.exp $test_home/regression.out exit 1 fi diff -u $test_home/regression.exp $test_home/regression.out if [ $? != 0 ]; then echo $num_passed tests passed but diff failed exit 2 else echo $num_passed tests passed exit 0 fi diff --git a/tools/test.iso8601.c b/tools/test.iso8601.c index fa78b800b3..25da012992 100644 --- a/tools/test.iso8601.c +++ b/tools/test.iso8601.c @@ -1,145 +1,205 @@ /* * Copyright (C) 2005 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include char command = 0; /* *INDENT-OFF* */ static struct crm_option long_options[] = { /* Top-level Options */ {"help", 0, 0, '?', "\tThis text"}, {"version", 0, 0, '$', "\tVersion information" }, {"verbose", 0, 0, 'V', "\tIncrease debug output"}, {"-spacer-", 0, 0, '-', "\nCommands:"}, {"now", 0, 0, 'n', "\tDisplay the current date/time"}, {"date", 1, 0, 'd', "Parse an ISO8601 date/time. Eg. '2005-01-20 00:30:00 +01:00' or '2005-040'"}, {"period", 1, 0, 'p', "Parse an ISO8601 date/time with interval/period (wth start time). Eg. '2005-040/2005-043'"}, {"duration", 1, 0, 'D', "Parse an ISO8601 date/time with duration (wth start time). Eg. '2005-040/P1M'"}, + {"expected", 1, 0, 'E', "Parse an ISO8601 date/time with duration (wth start time). Eg. '2005-040/P1M'"}, {"-spacer-",0, 0, '-', "\nOutput Modifiers:"}, + {"seconds", 0, 0, 's', "\tShow result as a seconds since 0000-001 00:00:00Z"}, + {"epoch", 0, 0, 'S', "\tShow result as a seconds since EPOCH (1970-001 00:00:00Z)"}, {"local", 0, 0, 'L', "\tShow result as a 'local' date/time"}, {"ordinal", 0, 0, 'O', "\tShow result as an 'ordinal' date/time"}, {"week", 0, 0, 'W', "\tShow result as an 'calendar week' date/time"}, {"-spacer-",0, 0, '-', "\nFor more information on the ISO8601 standard, see: http://en.wikipedia.org/wiki/ISO_8601"}, {0, 0, 0, 0} }; /* *INDENT-ON* */ int main(int argc, char **argv) { + int rc = 0; int argerr = 0; int flag; int index = 0; int print_options = 0; - char *input_s = NULL; - char *mutable_s = NULL; - + ha_time_t *duration = NULL; + ha_time_t *date_time = NULL; + ha_time_period_t *interval = NULL; + + char *period_s = NULL; + char *duration_s = NULL; + char *date_time_s = NULL; + const char *expected_s = NULL; + crm_log_cli_init("iso8601"); crm_set_options(NULL, "command [output modifier] ", long_options, "Display and parse ISO8601 dates and times"); if (argc < 2) { argerr++; } while (1) { flag = crm_get_option(argc, argv, &index); if (flag == -1) break; switch (flag) { case 'V': crm_bump_log_level(argc, argv); break; case '?': case '$': crm_help(flag, 0); break; case 'n': - command = flag; + date_time_s = strdup("now"); break; case 'd': + date_time_s = strdup(optarg); + break; case 'p': + period_s = strdup(optarg); + break; case 'D': - command = flag; - input_s = strdup(optarg); + duration_s = strdup(optarg); + break; + case 'E': + expected_s = optarg; + break; + case 'S': + print_options |= ha_date_epoch; + break; + case 's': + print_options |= ha_date_seconds; break; case 'W': print_options |= ha_date_weeks; break; case 'O': print_options |= ha_date_ordinal; break; case 'L': print_options |= ha_log_local; break; + break; } } - if (input_s == NULL && command != 'n') { - crm_help('?', 1); - } - - mutable_s = input_s; - - if (command == 'd') { - ha_time_t *date_time = parse_date(&mutable_s); + if(safe_str_eq("now", date_time_s)) { + date_time = new_ha_date(TRUE); if (date_time == NULL) { - fprintf(stderr, "Invalid date/time specified: %s\n", input_s); + fprintf(stderr, "Internal error: couldnt determin 'now' !\n"); crm_help('?', 1); } - log_date(-1, "parsed", date_time, print_options | ha_log_date | ha_log_time); + log_date(LOG_TRACE, "Current date/time", date_time, ha_date_ordinal | ha_log_date | ha_log_time); + log_date(-1, "Current date/time", date_time, print_options | ha_log_date | ha_log_time); - } else if (command == 'p') { - ha_time_period_t *interval = parse_time_period(&mutable_s); + } else if(date_time_s) { + date_time = parse_date(&date_time_s); - if (interval == NULL) { - fprintf(stderr, "Invalid interval specified: %s\n", input_s); + if (date_time == NULL) { + fprintf(stderr, "Invalid date/time specified: %s\n", optarg); crm_help('?', 1); } - log_time_period(-1, interval, print_options | ha_log_date | ha_log_time); + log_date(LOG_TRACE, "Date", date_time, ha_date_ordinal | ha_log_date | ha_log_time); + log_date(-1, "Date", date_time, print_options | ha_log_date | ha_log_time); + } - } else if (command == 'D') { - ha_time_t *duration = parse_time_duration(&mutable_s); + if(duration_s) { + duration = parse_time_duration(&duration_s); if (duration == NULL) { - fprintf(stderr, "Invalid duration specified: %s\n", input_s); + fprintf(stderr, "Invalid duration specified: %s\n", optarg); crm_help('?', 1); } - log_date(-1, "Duration", duration, - print_options | ha_log_date | ha_log_time | ha_log_local); + log_date(LOG_TRACE, "Duration", duration, ha_date_ordinal | ha_log_date | ha_log_time); + log_date(-1, "Duration", duration, print_options | ha_log_date | ha_log_time | ha_log_local); + } - } else if (command == 'n') { - ha_time_t *now = new_ha_date(TRUE); + if(period_s) { + interval = parse_time_period(&period_s); - if (now == NULL) { - fprintf(stderr, "Internal error: couldnt determin 'now' !\n"); + if (interval == NULL) { + fprintf(stderr, "Invalid interval specified: %s\n", optarg); crm_help('?', 1); } - log_date(-1, "Current date/time", now, print_options | ha_log_date | ha_log_time); + log_time_period(-1, interval, print_options | ha_log_date | ha_log_time); + } + + if(date_time && duration) { + ha_time_t *later = add_time(date_time, duration); + + log_date(LOG_TRACE, "Duration ends at", later, ha_date_ordinal | ha_log_date | ha_log_time); + log_date(-1, "Duration ends at", later, print_options | ha_log_date | ha_log_time | ha_log_local); + if(expected_s) { + char *dt_s = date_to_string(later, print_options | ha_log_date | ha_log_time); + if(safe_str_neq(expected_s, dt_s)) { + rc = 1; + } + free(dt_s); + } + free_ha_date(later); + + } else if(date_time && expected_s) { + char *dt_s = date_to_string(date_time, print_options | ha_log_date | ha_log_time); + if(safe_str_neq(expected_s, dt_s)) { + rc = 1; + } + free(dt_s); } - return 0; + /* if(date_time && interval) { */ + /* } */ + + free_ha_date(date_time); + free_ha_date(duration); + if(interval) { + free_ha_date(interval->start); + free_ha_date(interval->end); + free_ha_date(interval->diff); + free(interval); + } + + free(date_time_s); + free(duration_s); + free(period_s); + + qb_log_fini(); + return rc; }