#******************************************************************************
# Copyright (c) 2010 Arapiki Solutions Inc.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#    "Peter Smith <psmith@arapiki.com>" - initial API and 
#        implementation and/or initial documentation
#*******************************************************************************/ 

#
# SConscript - the build description for the CFS interposer test suite.
#

Import('*')

# Build the CFS interposer unit test suites. This assumes that the cunit library is
# available on this build machine (it's not included in this source tree).
env.Program('run_test_interposer', 
	['test_interposer/main.c', 
	 'test_interposer/file_name_utils_suite.c',
	 'test_interposer/regress_glibc_suite.c',
	 'test_interposer/trace_buffer_suite.c',
	 'test_interposer/test_helpers.c'], 
	LIBS=['cunit', cfs_interposer_lib], CPPPATH="#src/interposer")

#
# If the user enters "scons test", we'll compile and run the unit tests, using
# the interposer library. Note that the 'test-results' target is just a dummy
# and is never actually created.
#
env.Command('test_results', 'run_test_interposer', 
	"sh -c 'LD_PRELOAD=" + str(cfs_interposer_lib[0]) + " ./$SOURCE'")
env.Alias('test', 'test_results')