#!/bin/bash

d=$PWD
[[ $PORTDIR == "" ]] && PORTDIR=$(portageq envvar PORTDIR)
cd ${PORTDIR}/metadata/cache || { echo SKIPPED; exit 0 ; }

echo -n "atom_explode():"
time find . -mindepth 2 -type f -printf '%P\n%f\n' | "$d"/q > "$d"/me
echo

echo -n "portage:"
time find . -mindepth 2 -type f -printf '%P\n%f\n' | "$d"/atom-explode.py > "$d"/py
echo

if diff -U 0 "$d"/me "$d"/py ; then
	echo "PASSED"
else
	echo "FAIL ! :("
fi
