source: branches/samba-3.3.x/source/stf/notes.txt@ 461

Last change on this file since 461 was 206, checked in by Herwig Bauernfeind, 16 years ago

Import Samba 3.3 branch at 3.0.0 level (psmedley's port)

File size: 5.8 KB
Line 
1 -*- indented-text -*-
2
3(set lotus no)
4
5
6
7Notes on using comfychair with Samba (samba testing framework units):
8
9The tests need to rely on some external resources, such as
10
11If suitable resources are not available, need to skip particular
12tests. Must include a message indicating what resources would be
13needed to run that test. (e.g. must be root.)
14
15We want to be able to select and run particular subsets of tests, such
16as "all winbind tests".
17
18We want to keep the number of configurable parameters down as much as
19possible, to make it easy on people running the tests.
20
21Wherever possible, the tests should set up their preconditions, but a
22few basic resources need to be provided by the people running the
23tests. So for example, rather than asking the user for the name of a
24non-root user, we should give the tests the administrator name and
25password, and it can create a new user to use.
26
27This makes it simpler to get the tests running, and possible also
28makes them more reproducible.
29
30In the future, rather than using NT machines provided by the test
31person, we might have a way to drive VMWare non-persistent sessions,
32to make tests even more tightly controlled.
33
34
35Another design question is how to communicate this information to the
36tests. If there's a lot of settings, then it might need to be stored
37in a configuration file.
38
39However, if we succeed in cutting down the number of parameters, then
40it might be straightforward to pass the information on the command
41line or in an environment variable.
42
43Environment variables are probably better because they can't be seen
44by other users, and they are more easily passed down through an
45invocation of "make check".
46
47
48
49
50Notes on Samba Testing Framework for Unittests
51----------------------------------------------
52
53This is to be read after reading the notes.txt from comfychair. I'm
54proposing a slightly more concrete description of what's described
55there.
56
57The model of having tests require named resources looks useful for
58incorporation into a framework that can be run by many people in
59widely different environments.
60
61Some possible environments for running the test framework in are:
62
63 - Casual downloader of Samba compiling from source and just wants
64 to run 'make check'. May only have one Unix machine and a
65 handful of clients.
66
67 - Samba team member with access to a small number of other
68 machines or VMware sessions.
69
70 - PSA developer who may not have intimate knowledge of Samba
71 internals and is only interested in testing against the PSA.
72
73 - Non-team hacker wanting to run test suite after making small
74 hacks.
75
76 - Build farm environment (loaner machine with no physical access
77 or root privilege).
78
79 - HP BAT.
80
81Developers in most of these environments are also potential test case
82authors. It should be easy for people unfamiliar with the framework
83to write new tests and have them work. We should provide examples and
84the existing tests should well written and understandable.
85
86Different types of tests:
87
88 - Tests that check Samba internals and link against
89 libbigballofmud.so. For example:
90
91 - Upper/lowercase string functions
92 - user_in_list() for large lists
93
94 - Tests that use the Samba Python extensions.
95
96 - Tests that execute Samba command line programs, for example
97 smbpasswd.
98
99 - Tests that require other resources on the network such as domain
100 controllers or PSAs.
101
102 - Tests that are performed on the documentation or the source code
103 such as:
104
105 - grep for common spelling mistakes made by abartlet (-:
106 - grep for company copyright (IBM, HP)
107
108 - Link to other existing testing frameworks (smbtorture,
109 abartlet's bash based build farm tests)
110
111I propose a TestResourceManager which would be instantiated by a test
112case. The test case would require("resourcename") as part of its
113constructor and raise a comfychair.NotRun exception if the resource
114was not present. A TestResource class could be defined which could
115read a configuration file or examine a environment variable and
116register a resource only if some condition was satisfied.
117
118It would be nice to be able to completely separate the PSA testing
119from the test framework. This would entail being able to define test
120resources dynamically, possibly with a plugin type system.
121
122class TestResourceManager:
123 def __init__(self, name):
124 self.resources = {}
125
126 def register(self, resource):
127 name = resource.name()
128 if self.resources.has_key(name):
129 raise "Test manager already has resource %s" % name
130 self.resources[name] = resource
131
132 def require(self, resource_name):
133 if not self.resources.has_key(resource_name):
134 raise "Test manager does not have resources %s" % resource_name
135
136class TestResource:
137 def __init__(self, name):
138 self.name = name
139
140 def name(self):
141 return self.name
142
143import os
144
145trm = TestResourceManager()
146
147if os.getuid() == 0:
148 trm.register(TestResource("root"))
149
150A config-o-matic Python module can take a list of machines and
151administrator%password entries and classify them by operating system
152version and service pack. These resources would be registered with
153the TestResourceManager.
154
155Some random thoughts about named resources for network servers:
156
157require("nt4.sp3")
158require("nt4.domaincontroller")
159require("psa")
160
161Some kind of format for location of passwords, libraries:
162
163require("exec(smbpasswd)")
164require("lib(bigballofmud)")
165
166maybe require("exec.smbpasswd") looks nicer...
167
168The require() function could return a dictionary of configuration
169information or some handle to fetch dynamic information on. We may
170need to create and destroy extra users or print queues. How to manage
171cleanup of dynamic resources?
172
173Requirements for running stf:
174
175 - Python, obviously
176 - Samba python extensions
Note: See TracBrowser for help on using the repository browser.