git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 13/13] Add a validation script

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jul 7, 2010, 00:14 UTC
Message-ID
<1278461693-3828-14-git-send-email-artagnon@gmail.com>
In-Reply-To
<1278461693-3828-1-git-send-email-artagnon@gmail.com>

Add a validation script along with a .gitignore. Using an existing dump known to be correct (possibly generated using `svnsync` and `svnadmin dump --deltas`), it compares the outputs produced by `svnadmin load` when fed with this dump and the dump from the program.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 .gitignore  |    4 ++++
 validate.sh |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore
 create mode 100755 validate.sh
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3e9b906
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*~
+t/
+svndumpr
+svndumpr_bench
diff --git a/validate.sh b/validate.sh
new file mode 100755
index 0000000..7b25db6
--- /dev/null
+++ b/validate.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+# asf.dump must exist in t/
+# Compile the program with end_revision = $2 when using the second branch
+
+case $1 in
+    generate)
+	[ -z $2 ] && { echo "Usage: $0 $1 <revision>"; exit 1; } || echo "Starting generation ...";
+	if test -e "t/asf.dump"
+	    then :;
+	else
+	    echo "Need t/asf.dump (dumpfile v3) first. Generate it yourself or steal it from someone.";
+	    exit 1;
+	fi
+	rm -rf t/repo;
+	mkdir t/repo;
+	svnadmin create t/repo;
+	gawk "/Revision-number: $(($2 + 1))/ { exit 1 }; { print \$0 };" t/asf.dump > "t/asf-$2.dump";
+	[ $? = 1 ] && echo "Cut $2 succeeded!" || { echo "Cut $2 failed. Check t/asf.dump and validate.sh."; exit 1; }
+	svnadmin load t/repo < "t/asf-$2.dump" 1>"t/asf-$2-import.log" 2>"t/asf-$2-import.error";
+	[ $? = 0 ] && echo "Load $2 succeeded!" || { echo "Load $2 failed. See t/asf-$2-import.debug for details."; exit 1; }
+	echo "Successfully generated asf-$2.dump and asf-$2-import.log. You can now run validate.sh validate $2"
+	exit 0;;
+    validate)
+	[ -z $2 ] && { echo "Usage: $0 $1 <revision>"; exit 1; } || echo "Starting validation ...";
+	if test -e "t/asf-$2.dump" && test -e "t/asf-$2-import.log"
+	    then :;
+	else
+	    echo "Run validate.sh genereate $2 first.";
+	    exit 1;
+	fi
+	rm -rf /tmp/svn-fe;
+	mkdir /tmp/svn-fe;
+	rm -rf t/repo;
+	mkdir t/repo;
+	svnadmin create t/repo;
+	make svndumpr > /dev/null;
+	[ $? = 0 ] && echo "Make succeeded!" || { echo "Make failed. Check the program."; exit 1; }
+	./svndumpr 1>t/asf-mine.dump;
+	[ $? = 0 ] && echo "Run succeeded!" || { echo "Run failed. See t/asf.debug for details."; exit 1; }
+	diff -au "t/asf-$2.dump" t/asf-mine.dump > t/dump-diff.error;
+	gawk '$0 !~ "Prop-delta: true|Text-delta-base-|sha1|Text-copy-source-|^-$" && $0 ~ "^+|^-" { print; }' t/dump-diff.error > t/dump-diff-filtered.error;
+	svnadmin load t/repo < t/asf-mine.dump 1>t/asf-mine-import.log 2>t/asf-mine-import.error;
+	[ $? = 0 ] && echo "Load $2 succeeded!" || { echo "Load failed. See t/asf-mine-import.error, t/dump-diff.error, and t/dump-diff-filtered.error for details."; exit 1; }
+	diff -au "t/asf-$2-import.log" t/asf-mine-import.log > t/import-diff.error;
+	[ $? = 0 ] && echo "Validation $2 succeeded!" || { echo "Validation failed. See t/import-diff.error for details."; exit 1; }
+	exit 0;;
+    *)
+	echo "Usage: $0 <operation> <revision>";
+	exit 1;;
+esac
-- 
1.7.1
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 30 of 31 in “[GSoC update] git-remote-svn: Week 10”
  1. Ramkumar RamachandraJul 7, 2010
  2. 01/13 Add LICENSERamkumar Ramachandra, Jul 7, 2010
  3. 02/13 Add skeleton SVN client and MakefileRamkumar Ramachandra, Jul 7, 2010
  4. Jonathan NiederJul 7, 2010
  5. Ramkumar RamachandraJul 7, 2010
  6. Jonathan NiederJul 7, 2010
  7. Ramkumar RamachandraJul 7, 2010
  8. Daniel ShahafJul 7, 2010
  9. 03/13 Add debug editor from Subversion trunkRamkumar Ramachandra, Jul 7, 2010
  10. Jonathan NiederJul 7, 2010
  11. 04/13 Add skeleton dump editorRamkumar Ramachandra, Jul 7, 2010
  12. Jonathan NiederJul 7, 2010
  13. Ramkumar RamachandraJul 8, 2010
  14. 05/13 Drive the debug editorRamkumar Ramachandra, Jul 7, 2010
  15. Jonathan NiederJul 7, 2010
  16. Ramkumar RamachandraJul 7, 2010
  17. Jonathan NiederJul 7, 2010
  18. Ramkumar RamachandraJul 8, 2010
  19. 06/13 Dump the revprops at the start of every revisionRamkumar Ramachandra, Jul 7, 2010
  20. Jonathan NiederJul 7, 2010
  21. Ramkumar RamachandraJul 21, 2010
  22. Julian FoadJul 26, 2010
  23. Ramkumar RamachandraJul 26, 2010
  24. 07/13 Implement open_root and close_editRamkumar Ramachandra, Jul 7, 2010
  25. 08/13 Implement dump_nodeRamkumar Ramachandra, Jul 7, 2010
  26. 09/13 Implement directory-related functionsRamkumar Ramachandra, Jul 7, 2010
  27. 10/13 Implement file-related functionsRamkumar Ramachandra, Jul 7, 2010
  28. 11/13 Implement apply_textdeltaRamkumar Ramachandra, Jul 7, 2010
  29. 12/13 Implement close_fileRamkumar Ramachandra, Jul 7, 2010
  30. 13/13 Add a validation scriptRamkumar Ramachandra, Jul 7, 2010
  31. Ramkumar RamachandraJul 7, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.