Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/scripts/test_install.py
Views: 275
1
#!/usr/bin/env python
2
###############################################################################
3
#
4
# CoCalc: Collaborative Calculation
5
#
6
# Copyright (C) 2016, Sagemath Inc.
7
#
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, either version 3 of the License, or
11
# (at your option) any later version.
12
#
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
#
21
###############################################################################
22
"""
23
This script runs tests to verify that a given SMC machine has all claimed software installed, and that it maybe
24
even works a little bit.
25
"""
26
27
import math, os, sys, time
28
from subprocess import Popen, PIPE
29
30
31
def test_atlas():
32
for f in ['libatlas.so', 'libcblas.so', 'libf77blas.so']:
33
if not os.path.exists('/usr/lib/%s' % f):
34
return "/usr/lib/%s doesn't exists" % f
35
36
37
def test_sage_packages():
38
imports = """
39
h5py
40
clawpack
41
tornado
42
virtualenv
43
pandas
44
statsmodels
45
numexpr
46
tables
47
sklearn # this is for scikit-learn
48
theano
49
scikits-image
50
shapely # for the Shapely package
51
simpy
52
xlrd xlwt
53
pyproj
54
bitarray
55
h5py
56
netCDF4
57
patsy
58
lxml
59
munkres
60
oct2py
61
psutil
62
plotly
63
mahotas
64
snappy
65
scimath
66
rpy2
67
neuron
68
mpl_toolkits.basemap
69
Bio
70
brian
71
Gnuplot
72
guppy
73
nose
74
nzmath
75
pybtex
76
CryptoPlus
77
pyx
78
zmq
79
"""
80
imports = sum([x.split('#')[0].split() for x in imports.splitlines()], [])
81
82
p = Popen(["sage"], shell=True, stdin=PIPE, stdout=PIPE, close_fds=True)
83
(child_stdout, child_stdin) = (p.stdout, p.stdin)
84
child_stdin.write('\n'.join('import %s' % m for m in imports))
85
child_stdin.close()
86
bad = [
87
out.split()[-1] for out in child_stdout.readlines()
88
if 'No module' in out
89
]
90
return ','.join(bad)
91
92
93
def main():
94
g = globals()
95
for k, t in sorted(g.items()):
96
if k.startswith("test_"):
97
print k, "...",
98
sys.stdout.flush()
99
t0 = time.time()
100
a = t()
101
sys.stdout.write(" (%s seconds)" % (int(time.time() - t0)))
102
if a:
103
print "FAIL!: %s" % a
104
else:
105
print
106
107
108
if __name__ == "__main__":
109
main()
110
111