validate: move look_for_file_in_source_dir and get_valgrind_suppression_file to utils

Reviewers: thiblahute

Differential Revision: http://phabricator.freedesktop.org/D130
This commit is contained in:
Guillaume Desmottes 2015-04-27 13:25:44 +02:00 committed by Thibault Saunier
parent 6a89662da6
commit c5c39d88b1
2 changed files with 27 additions and 16 deletions

View file

@ -25,7 +25,6 @@ import re
import time
import utils
import signal
import config
import urlparse
import subprocess
import threading
@ -37,7 +36,7 @@ from loggable import Loggable
import xml.etree.cElementTree as ET
from utils import mkdir, Result, Colors, printc, DEFAULT_TIMEOUT, GST_SECOND, \
Protocols
Protocols, look_for_file_in_source_dir, get_valgrind_suppression_file
# The factor by which we increase the hard timeout when running inside
# Valgrind
@ -401,7 +400,7 @@ class GstValidateTest(Test):
# application which is using rpath instead of libtool's wrappers. It's
# slightly faster to start and will not confuse valgrind.
debug = '%s-debug' % application_name
p = self.look_for_file_in_source_dir('tools', debug)
p = look_for_file_in_source_dir('tools', debug)
if p:
application_name = p
@ -626,23 +625,11 @@ class GstValidateTest(Test):
return position
def look_for_file_in_source_dir(self, subdir, name):
root_dir = os.path.abspath(os.path.dirname(os.path.join(os.path.dirname(os.path.abspath(__file__)))))
p = os.path.join(root_dir, subdir, name)
if os.path.exists(p):
return p
def get_valgrind_suppression_file(self, subdir, name):
# Are we running from sources?
p = self.look_for_file_in_source_dir(subdir, name)
p = get_valgrind_suppression_file(subdir, name)
if p:
return p
# Look in system data dirs
p = os.path.join(config.DATADIR, 'gstreamer-1.0', 'validate', name)
if os.path.exists(p):
return p
self.error("Could not find any %s file" % name)
def get_valgrind_suppressions(self):

View file

@ -18,6 +18,7 @@
# Boston, MA 02110-1301, USA.
""" Some utilies. """
import config
import os
import re
import sys
@ -181,6 +182,29 @@ def TIME_ARGS(time):
(time / GST_SECOND) % 60,
time % GST_SECOND)
def look_for_file_in_source_dir(subdir, name):
root_dir = os.path.abspath(os.path.dirname(os.path.join(os.path.dirname(os.path.abspath(__file__)))))
p = os.path.join(root_dir, subdir, name)
if os.path.exists(p):
return p
return None
def get_valgrind_suppression_file(subdir, name):
# Are we running from sources?
p = look_for_file_in_source_dir(subdir, name)
if p:
return p
# Look in system data dirs
p = os.path.join(config.DATADIR, 'gstreamer-1.0', 'validate', name)
if os.path.exists(p):
return p
return None
#
# Some utilities to parse gst-validate output #
#