#!/bin/bash

function check_okay {
	if [ $? -ne 0 ]
	then
		exit 1
	fi
}

function do_onex {
	cd $1
	if [ -r mesa_dir.rb ]
  then
    echo '$'"MESA_DIR = '../../../..'" > mesa_dir.rb
  fi
	cd ..
}

function do_one {
	cd $1
	check_okay
	echo "clean" $1
	./clean
	rm -f LOGS/*
	rm -f LOGS1/*
	rm -f LOGS2/*
	rm -f photos/*
	rm -f photos1/*
	rm -f photos2/*
	rm -f out.txt
  if [ -r star_history/history_out ]
  then
  	rm -f star_history/history_out/*
  fi
  if [ -r star_profile/profiles_out ]
  then
  	rm -f star_profile/profiles_out/*
  fi
	cd ..
}

source do1_binary_test_source
