Skip to content

Commit

Permalink
Merge PR #456 (@smondet, lighten logging)
Browse files Browse the repository at this point in the history
  • Loading branch information
smondet committed Aug 10, 2016
2 parents 2f53b5b + e6879ea commit 93389dc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
17 changes: 6 additions & 11 deletions src/lib/persistent_data.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1027,9 +1027,8 @@ let find_all_orphans t =
end
>>= fun (`Passives passives, `Actives actives)->
log_items := !log_items @ Display_markup.[
"actives", itemize (
List.map actives ~f:Target.(fun st -> textf "%s (%s)" (id st) (name st))
);
"actives", big_itemize actives
~render:Target.(fun st -> textf "%s (%s)" (id st) (name st));
"passives", textf "%d targets" (List.length passives);
];
(* To find all the reachable-passives, we use [to_check] as a stack of
Expand Down Expand Up @@ -1077,20 +1076,16 @@ let find_all_orphans t =
>>| List.dedup ~compare:(fun a b -> compare (Target.id a) (Target.id b))
>>= fun reachable ->
log_items := !log_items @ Display_markup.[
"reachable", itemize (
List.map reachable
~f:Target.(fun st -> textf "%s (%s)" (id st) (name st))
);
"reachable", big_itemize reachable
~render:Target.(fun st -> textf "%s (%s)" (id st) (name st));
];
let unreachable_passives =
List.filter passives ~f:(fun p ->
List.for_all reachable ~f:(fun rp -> Target.id rp <> Target.id p))
in
log_items := !log_items @ Display_markup.[
"unreachable", itemize (
List.map unreachable_passives
~f:Target.(fun st -> textf "%s (%s)" (id st) (name st));
);
"unreachable", big_itemize unreachable_passives
~render:Target.(fun st -> textf "%s (%s)" (id st) (name st));
"end", date_now ();
];
Logger.log Display_markup.(description_list !log_items);
Expand Down
7 changes: 7 additions & 0 deletions src/pure/internal_pervasives.ml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,13 @@ module Display_markup = struct
| None -> textf "%S" s
| Some substr -> textf "%S... %d Bytes" substr (String.length s)

let big_itemize ?(max_display = 10) ~render l =
match List.length l with
| small when small <= max_display ->
itemize (List.map l ~f:render)
| big ->
textf "%d items" big

let rec log =
function
| Date f -> Time.log f
Expand Down
5 changes: 2 additions & 3 deletions tools/travis_ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ git clone git://github.com/smondet/trakeva
cd trakeva
make configure
make
# On OSX we start our own postgresql server, on linux we use the one of the box
# On OSX we start our own postgresql server, on linux we don't run the tests
case $TRAVIS_OS_NAME in
osx) ./trakeva_tests ;;
linux)
POSTGRESQL_CONNECTION_INFO=postgresql://127.0.0.1/template1 ./trakeva_tests ;;
linux) echo "No trakeva tests" ;;
*) echo "Unknown $TRAVIS_OS_NAME"; exit 1
esac
cd ..
Expand Down

0 comments on commit 93389dc

Please sign in to comment.