Permalink
Browse files

test single fsync

Change-Id: I5c33ef982d332811ea3964874b0383b0f59899d0
  • Loading branch information...
1 parent fa32842 commit 4a0ce203f3c2b343e1dd23d1b810ead5a7df21b7 @apage43 committed Mar 26, 2013
Showing with 174 additions and 1 deletion.
  1. +127 −0 config/test-driver
  2. +1 −1 src/couch_db.c
  3. +14 −0 test-suite.log
  4. +28 −0 testapp.log
  5. +4 −0 testapp.trs
View
@@ -0,0 +1,127 @@
+#! /bin/sh
+# test-driver - basic testsuite driver script.
+
+scriptversion=2012-06-27.10; # UTC
+
+# Copyright (C) 2011-2013 Free Software Foundation, Inc.
+#
+# 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, or (at your option)
+# any later version.
+#
+# This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+# Make unconditional expansion of undefined variables an error. This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+usage_error ()
+{
+ echo "$0: $*" >&2
+ print_usage >&2
+ exit 2
+}
+
+print_usage ()
+{
+ cat <<END
+Usage:
+ test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+ [--expect-failure={yes|no}] [--color-tests={yes|no}]
+ [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
+The '--test-name', '--log-file' and '--trs-file' options are mandatory.
+END
+}
+
+# TODO: better error handling in option parsing (in particular, ensure
+# TODO: $log_file, $trs_file and $test_name are defined).
+test_name= # Used for reporting.
+log_file= # Where to save the output of the test script.
+trs_file= # Where to save the metadata of the test run.
+expect_failure=no
+color_tests=no
+enable_hard_errors=yes
+while test $# -gt 0; do
+ case $1 in
+ --help) print_usage; exit $?;;
+ --version) echo "test-driver $scriptversion"; exit $?;;
+ --test-name) test_name=$2; shift;;
+ --log-file) log_file=$2; shift;;
+ --trs-file) trs_file=$2; shift;;
+ --color-tests) color_tests=$2; shift;;
+ --expect-failure) expect_failure=$2; shift;;
+ --enable-hard-errors) enable_hard_errors=$2; shift;;
+ --) shift; break;;
+ -*) usage_error "invalid option: '$1'";;
+ esac
+ shift
+done
+
+if test $color_tests = yes; then
+ # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
+ red='' # Red.
+ grn='' # Green.
+ lgn='' # Light green.
+ blu='' # Blue.
+ mgn='' # Magenta.
+ std='' # No color.
+else
+ red= grn= lgn= blu= mgn= std=
+fi
+
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
+trap "st=129; $do_exit" 1
+trap "st=130; $do_exit" 2
+trap "st=141; $do_exit" 13
+trap "st=143; $do_exit" 15
+
+# Test script is run here.
+"$@" >$log_file 2>&1
+estatus=$?
+if test $enable_hard_errors = no && test $estatus -eq 99; then
+ estatus=1
+fi
+
+case $estatus:$expect_failure in
+ 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
+ 0:*) col=$grn res=PASS recheck=no gcopy=no;;
+ 77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
+ 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
+ *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
+ *:*) col=$red res=FAIL recheck=yes gcopy=yes;;
+esac
+
+# Report outcome to console.
+echo "${col}${res}${std}: $test_name"
+
+# Register the test result, and other relevant metadata.
+echo ":test-result: $res" > $trs_file
+echo ":global-test-result: $res" >> $trs_file
+echo ":recheck: $recheck" >> $trs_file
+echo ":copy-in-global-log: $gcopy" >> $trs_file
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
View
@@ -181,7 +181,7 @@ couchstore_error_t couchstore_commit(Db *db)
//Extend file size to where end of header will land before we do first sync
db_write_buf(&db->file, &zerobyte, NULL, NULL);
- couchstore_error_t errcode = db->file.ops->sync(db->file.handle);
+ couchstore_error_t errcode = COUCHSTORE_SUCCESS;
//Set the pos back to where it was when we started to write the real header.
db->file.pos = curpos;
View
@@ -0,0 +1,14 @@
+=============================================================
+ libcouchstore 2.0.1_linux_30_gfa32842: ./test-suite.log
+=============================================================
+
+# TOTAL: 1
+# PASS: 1
+# SKIP: 0
+# XFAIL: 0
+# FAIL: 0
+# XPASS: 0
+# ERROR: 0
+
+.. contents:: :depth: 2
+
View
@@ -0,0 +1,28 @@
+opening nonexistent file errors... OS Error: errno = 0: `Undefined error: 0'
+OK
+dump empty db... OK
+save_doc... OK
+save_docs (doc count 4)... get by ID... bulk IDs... get by sequence... bulk sequences... changes_since... OK
+save_docs (doc count 4)... get by ID... bulk IDs... get by sequence... bulk sequences... changes_since... OK
+save_docs (doc count 69)... get by ID... bulk IDs... get by sequence... bulk sequences... changes_since... OK
+save_docs (doc count 69)... get by ID... bulk IDs... get by sequence... bulk sequences... changes_since... OK
+save_docs (doc count 666)... get by ID... bulk IDs... get by sequence... bulk sequences... changes_since... OK
+save_docs (doc count 666)... get by ID... bulk IDs... get by sequence... bulk sequences... changes_since... OK
+save_docs (doc count 9090)... get by ID... bulk IDs... get by sequence... bulk sequences... changes_since... OK
+save_docs (doc count 9090)... get by ID... bulk IDs... get by sequence... bulk sequences... changes_since... OK
+local docs... OK
+compressed bodies... OK
+changes no dupes... OK
+regression mb-5086.... OK
+huge rev_seq.... OK
+JSON collation: escapes... scalars... ASCII... raw... arrays... nesting... Unicode... OK
+Indexer: OK
+Using test database at testfile.couch
+Index header is at 0x9000
+ Root: type=0, pointer=27326, subtreesize=28018, reduce=209 bytes
+ SubTreeCount = 1000
+ Bitmap = <fb795922 3dd7de19 976b72b1 bef7630b ac75fae2 e1bbe595 71f794f1 377a3723 e93cffc7 9aeafefd 9bb67fff 7aa76551 4f42fd9f 719df5ff 0e27db0f f533f37a 3d857726 baddf3db 653cd4dd 7bfdbb82 32c7cb74 5ad85f7e fd7cfd95 c0aa6e53 df8ca830 fd673fef 9870c6c7 7aacb6fd b6e9ec3c b8dfb96f fbf49d6f 3fcf2fb5 >
+ JSONReduction = '{"count":1000,"max":99.51,"min":0.18,"sum":49547.93,"sumsqr":3272610.9289}'
+ Root: type=1, pointer=36374, subtreesize=8830, reduce=133 bytes
+ SubTreeCount = 1000
+ Bitmap = <fb795922 3dd7de19 976b72b1 bef7630b ac75fae2 e1bbe595 71f794f1 377a3723 e93cffc7 9aeafefd 9bb67fff 7aa76551 4f42fd9f 719df5ff 0e27db0f f533f37a 3d857726 baddf3db 653cd4dd 7bfdbb82 32c7cb74 5ad85f7e fd7cfd95 c0aa6e53 df8ca830 fd673fef 9870c6c7 7aacb6fd b6e9ec3c b8dfb96f fbf49d6f 3fcf2fb5 >
View
@@ -0,0 +1,4 @@
+:test-result: PASS
+:global-test-result: PASS
+:recheck: no
+:copy-in-global-log: no

0 comments on commit 4a0ce20

Please sign in to comment.