ia64/xen-unstable

view tools/xm-test/lib/XmTestReport/arch.py @ 12765:43671a60b0f1

Merge
author Alastair Tse <atse@xensource.com>
date Fri Dec 01 18:33:11 2006 +0000 (2006-12-01)
parents 17f48b5907a6
children
line source
1 #!/usr/bin/python
2 """
3 arch.py - Encapsulate all logic regarding what type of hardware xen
4 is running on to make adding new platforms easier.
6 Copyright (C) 2006 Tony Breeds IBM Corporation
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; under version 2 of the License.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 """
23 import os
25 """Convert from uname specification to a more general platform."""
26 _uname_to_arch_map = {
27 "i386" : "x86",
28 "i486" : "x86",
29 "i586" : "x86",
30 "i686" : "x86",
31 "x86_64": "x86_64",
32 "ia64" : "ia64",
33 "ppc" : "powerpc",
34 "ppc64" : "powerpc",
35 }
37 _arch = _uname_to_arch_map.get(os.uname()[4], "Unknown")
38 if _arch == "x86":
39 cpuValues = {"model_name" : "Unknown",
40 "flags" : "Unknown"}
41 elif _arch == "x86_64":
42 cpuValues = {"model_name" : "Unknown",
43 "flags" : "Unknown"}
44 elif _arch == "ia64":
45 cpuValues = {"arch" : "Unknown",
46 "features" : "Unknown"}
47 elif _arch == "powerpc":
48 cpuValues = {"cpu" : "Unknown",
49 "platform" : "Unknown",
50 "revision" : "Unknown"}
51 else:
52 raise ValueError, "Unknown architecture!"