From 9c83ccd0bc4c7ad0a699096089d4fe6c13d560a3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Fix test program to work with /etc/hosts and display all files recursively. --- Makefile.in | 3 ++- test_augeas.ml | 17 ++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index 178269e..97f7e15 100644 --- a/Makefile.in +++ b/Makefile.in @@ -55,7 +55,8 @@ test_augeas: test_augeas.cmo test_root test_root: rm -rf $@ mkdir $@ - cp /etc/hosts $@/ + mkdir $@/etc + cp /etc/hosts $@/etc/ # Clean. diff --git a/test_augeas.ml b/test_augeas.ml index 0124b58..1be88b7 100644 --- a/test_augeas.ml +++ b/test_augeas.ml @@ -20,18 +20,17 @@ let () = let aug = - let loadpath = Some "/usr/share/augeas/lenses" in + let loadpath = None in let flags = [ Augeas.AugSaveBackup ] in Augeas.create "test_root" loadpath flags in - (* Print all files. *) - let files = Augeas.matches aug "/files/*" in - List.iter print_endline files; - - (* Print all Augeas-metainfo. *) - let augs = Augeas.matches aug "/augeas/*" in - List.iter print_endline augs; - + (* Print all files recursively. *) + let rec print path = + if path <> "" then print_endline path; + let files = List.sort compare (Augeas.matches aug (path ^ "/*")) in + List.iter print files + in + print ""; (* Run the garbage collector to check for internal errors. *) Gc.compact () -- 1.8.3.1