sbsv2/raptor/test/smoke_suite/longpath.py
author Zheng Shen <zheng.shen@nokia.com>
Tue, 26 Oct 2010 11:12:31 +0800
changeset 654 7c11c3d8d025
parent 591 22486c9c7b15
permissions -rw-r--r--
romtools 13.2.0.1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
591
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
     1
#
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
     2
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
     3
# All rights reserved.
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
     4
# This component and the accompanying materials are made available
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
     6
# which accompanies this distribution, and is available
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
     8
#
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
     9
# Initial Contributors:
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    11
#
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    12
# Contributors:
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    13
#
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    14
# Description: 
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    15
#
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    16
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    17
from raptor_tests import SmokeTest
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    18
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    19
def run():
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    20
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    21
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    22
	# Content for files to be generated.
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    23
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    24
	cpp = "longerfilenamethanyoumightnormallyexpecttobepresent"
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    25
	path = "/test/smoke_suite/test_resources/longerpathnamesthanyoumightnormallyexpectinabuildtree/anotherlevelwithareallyreallyreallylongnamethistimeprobablyabitoverthetop/"
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    26
	path_eabi = "/test/smoke_suite/test_resources/longerpathnamesthanyoumightnormallyexpectinabuildtree/eabi/"
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    27
	
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    28
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    29
	# Some numbers for path and file operations
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    30
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    31
	cppStart = 1
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    32
	cppStop = 49
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    33
	
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    34
	import os
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    35
	import shutil
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    36
	import sys
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    37
	
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    38
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    39
	# Find SBS_Home
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    40
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    41
	sbsHome = os.environ["SBS_HOME"]
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    42
	
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    43
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    44
	# Create directories for both Linux and Windows
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    45
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    46
	d = os.path.dirname(sbsHome + path)
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    47
	if not os.path.exists(d):
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    48
		os.makedirs(d)
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    49
		
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    50
	d = os.path.dirname(sbsHome + path_eabi)
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    51
	if not os.path.exists(d):
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    52
		os.makedirs(d)
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    53
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    54
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    55
	# File generating utility
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    56
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    57
	while cppStart <= cppStop:
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    58
			t = str(cppStart)
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    59
			filename = sbsHome + path + 'test' + '%02d' %cppStart + '.cpp'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    60
			content = 'int x' + t + ' = 0;'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    61
			cppStart = cppStart + 1
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    62
			f = open (filename, 'w')
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    63
			f.write (content + '\n')
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    64
			f.close()
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    65
	cppStart = cppStart + 1
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    66
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    67
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    68
	# File copying utility
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    69
	#------------------------------------------------------------------------------
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    70
	dirname = sbsHome + '/test/smoke_suite/test_resources/long/paths/'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    71
	cpp = dirname + 'test.cpp'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    72
	bld = dirname + 'bld.inf'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    73
	deftest = dirname + 'deftest.mmp'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    74
	e32def = dirname + 'e32def.h'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    75
	
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    76
	deftestu = dirname + 'deftestu.def'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    77
	
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    78
	dst_cpp = sbsHome + path + 'test.cpp'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    79
	dst_bld = sbsHome + path + 'bld.inf'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    80
	dst_deftest = sbsHome + path + 'deftest.mmp'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    81
	dst_e32def = sbsHome + path + 'e32def.h'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    82
	dst_deftestu = sbsHome + path_eabi + 'deftestu.def'
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    83
	
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    84
		
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    85
	if os.path.exists(dst_cpp):
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    86
		pass
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    87
	else:
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    88
		shutil.copy(cpp, dst_cpp)
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    89
		shutil.copy(bld, dst_bld)
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    90
		shutil.copy(deftest, dst_deftest)
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    91
		shutil.copy(e32def, dst_e32def)
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    92
		shutil.copy(deftestu , dst_deftestu)
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    93
		dirname = sbsHome + path
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    94
		
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    95
	t = SmokeTest()
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    96
	t.id = "41"
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    97
	t.name = "longpath"
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    98
	t.command = "sbs -b " + \
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
    99
			"smoke_suite/test_resources/longerpathnamesthanyoumightnormallyexpectinabuildtree/anotherlevelwithareallyreallyreallylongnamethistimeprobablyabitoverthetop/bld.inf" + \
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   100
			" -c armv5"
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   101
	t.targets = [
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   102
		"$(EPOCROOT)/epoc32/release/armv5/udeb/deftest.dll.sym",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   103
		"$(EPOCROOT)/epoc32/release/armv5/urel/deftest.dll.sym",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   104
		"$(EPOCROOT)/epoc32/release/armv5/lib/deftest{000a0000}.dso",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   105
		"$(EPOCROOT)/epoc32/release/armv5/lib/deftest.dso",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   106
		"$(EPOCROOT)/epoc32/release/armv5/udeb/deftest.dll",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   107
		"$(EPOCROOT)/epoc32/release/armv5/udeb/deftest.dll.map",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   108
		"$(EPOCROOT)/epoc32/release/armv5/urel/deftest.dll",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   109
		"$(EPOCROOT)/epoc32/release/armv5/urel/deftest.dll.map"
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   110
		]
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   111
	t.addbuildtargets('smoke_suite/test_resources/longerpathnamesthanyoumightnormallyexpectinabuildtree/anotherlevelwithareallyreallyreallylongnamethistimeprobablyabitoverthetop/bld.inf', [
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   112
		"deftest_/armv5/udeb/deftest_udeb_objects.via",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   113
		"deftest_/armv5/udeb/test.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   114
		"deftest_/armv5/udeb/test09.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   115
		"deftest_/armv5/udeb/test19.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   116
		"deftest_/armv5/udeb/test29.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   117
		"deftest_/armv5/udeb/test39.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   118
		"deftest_/armv5/udeb/test49.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   119
		"deftest_/armv5/urel/deftest_urel_objects.via",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   120
		"deftest_/armv5/urel/test.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   121
		"deftest_/armv5/urel/test09.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   122
		"deftest_/armv5/urel/test19.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   123
		"deftest_/armv5/urel/test29.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   124
		"deftest_/armv5/urel/test39.o",
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   125
		"deftest_/armv5/urel/test49.o"
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   126
	])
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   127
	t.run()
22486c9c7b15 raptor v2.14.0
jjkang
parents:
diff changeset
   128
	return t