[Libguestfs] [PATCH hivex] tests: avoid spurious failure when run in non-srcdir build

Jim Meyering jim at meyering.net
Tue Aug 28 09:41:41 UTC 2012


Hi Rich,

I tried to run "make distcheck" and got a failed test.
This single line was in ocaml/t/hivex_120_rlenvalue.log:

  Fatal error: exception Hivex.Error("open", 20, "No such file or directory")

This change got me past it:

>From b446a2bb7aea5f8dc2cf80c83f068dfd6abf3b7a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Tue, 28 Aug 2012 11:39:51 +0200
Subject: [PATCH hivex] tests: avoid spurious failure when run in non-srcdir
 build

* ocaml/t/hivex_120_rlenvalue.ml: Avoid spurious failure when the
test is run in a non-srcdir (aka VPATH) build.  I.e., open a
$srcdir-relative name, rather than assuming $srcdir is ".".
---
 ocaml/t/hivex_120_rlenvalue.ml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ocaml/t/hivex_120_rlenvalue.ml b/ocaml/t/hivex_120_rlenvalue.ml
index 63c4cb2..827dc46 100644
--- a/ocaml/t/hivex_120_rlenvalue.ml
+++ b/ocaml/t/hivex_120_rlenvalue.ml
@@ -1,5 +1,5 @@
 (* hivex OCaml bindings
- * Copyright (C) 2009-2010 Red Hat Inc.
+ * Copyright (C) 2009-2010, 2012 Red Hat 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
@@ -26,9 +26,10 @@
 open Unix
 open Printf
 let (//) = Filename.concat
+let srcdir = try Sys.getenv "srcdir" with Not_found -> "."

 let () =
-  let h = Hivex.open_file "../images/rlenvalue_test_hive" [] in
+  let h = Hivex.open_file (srcdir // "../images/rlenvalue_test_hive") [] in
   let root = Hivex.root h in
   let moderate_value_node = Hivex.node_get_child h root "ModerateValueParent" in
   let moderate_value_value = Hivex.node_get_value h moderate_value_node "33Bytes" in
--
1.7.12.116.g31e0100




More information about the Libguestfs mailing list