#!/usr/bin/perl use File::Basename; use Cwd 'abs_path'; # Get the path for webkit-efl source. $sourcePath = abs_path(dirname(dirname($0))); unless (-d $sourcePath) { die "webkit-efl sources couldn't be found at: ", $sourcePath, "\n"; } # Get the tests patch. $testsPath = $sourcePath . "/Source/WebKit2/UIProcess/API/efl/tests/"; unless (-d $testsPath) { die "The test directory couldn't be found at: ", $testsPath, "\n"; } # Set an environment variable with resources path. $ENV{TEST_RESOURCES_DIR} = $testsPath . "resources/"; unless (-d $ENV{TEST_RESOURCES_DIR}) { die "The resources directory couldn't be found at: ", $ENV{TEST_RESOURCES_DIR}, "\n"; } # Determine the build directory. $buildPath = $sourcePath . "/WebKitBuild/Release/"; unless (-d $buildPath) { die "The build directory couldn't be found at: ", $buildPath, "\n"; } # Set LD_LIBRARY_PATH environment variable to find gtest library and newly built webkit engine $ENV{LD_LIBRARY_PATH} = $buildPath . "lib/"; unless (-d $ENV{LD_LIBRARY_PATH}) { die "The library path couldn't be found at: ", $ENV{LD_LIBRARY_PATH}, "\n"; } $binDir = $buildPath . "bin/"; unless (-d $binDir) { die "The directory with binaries couldn't be found at: ", $binDir, "\n"; } # Run the tests from the command line (if any). if (scalar(@ARGV)) { foreach $testName(@ARGV) { system($testName); } } else { opendir(DIR, $binDir); while (my $testName = readdir(DIR)) { next unless ($testName =~ m/^test_ewk2_/); # Execute the test. system($binDir . $testName); } closedir(DIR); }