]> git.saurik.com Git - apple/xnu.git/blame - iokit/Tests/Tests.cpp
xnu-3789.70.16.tar.gz
[apple/xnu.git] / iokit / Tests / Tests.cpp
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 *
30 */
31
3e170ce0 32#define TEST_HEADERS 0
1c79356b 33
3e170ce0 34#if TEST_HEADERS
1c79356b 35
3e170ce0
A
36#include <libkern/OSByteOrder.h>
37#include <libkern/c++/OSArray.h>
38#include <libkern/c++/OSBoolean.h>
39#include <libkern/c++/OSCollection.h>
40#include <libkern/c++/OSCollectionIterator.h>
41#include <libkern/c++/OSContainers.h>
42#include <libkern/c++/OSCPPDebug.h>
43#include <libkern/c++/OSData.h>
44#include <libkern/c++/OSDictionary.h>
45#include <libkern/c++/OSEndianTypes.h>
46#include <libkern/c++/OSIterator.h>
47#include <libkern/c++/OSKext.h>
48#include <libkern/c++/OSLib.h>
49#include <libkern/c++/OSMetaClass.h>
50#include <libkern/c++/OSNumber.h>
51#include <libkern/c++/OSObject.h>
52#include <libkern/c++/OSOrderedSet.h>
53#include <libkern/c++/OSSerialize.h>
54#include <libkern/c++/OSSet.h>
55#include <libkern/c++/OSString.h>
56#include <libkern/c++/OSSymbol.h>
57#include <libkern/c++/OSUnserialize.h>
58#include <libkern/crypto/aes.h>
59#include <libkern/crypto/aesxts.h>
60#include <libkern/crypto/crypto_internal.h>
61#include <libkern/crypto/des.h>
62#include <libkern/crypto/md5.h>
63#include <libkern/crypto/register_crypto.h>
64#include <libkern/crypto/sha1.h>
65#include <libkern/crypto/sha2.h>
66#include <libkern/kernel_mach_header.h>
67#include <libkern/kext_request_keys.h>
68#include <libkern/kxld.h>
69#include <libkern/kxld_types.h>
70#include <libkern/locks.h>
71#include <libkern/mkext.h>
72#include <libkern/OSAtomic.h>
73#include <libkern/OSBase.h>
74#include <libkern/OSDebug.h>
75#include <libkern/OSKextLib.h>
76#include <libkern/OSKextLibPrivate.h>
77#include <libkern/OSMalloc.h>
78#include <libkern/OSReturn.h>
79#include <libkern/OSSerializeBinary.h>
80#include <libkern/OSTypes.h>
81#include <libkern/prelink.h>
82#include <libkern/stack_protector.h>
83#include <libkern/sysctl.h>
84#include <libkern/tree.h>
85#include <libkern/zconf.h>
86#include <libkern/zlib.h>
87
88#include <IOKit/AppleKeyStoreInterface.h>
89#include <IOKit/assert.h>
90#include <IOKit/IOBSD.h>
91#include <IOKit/IOBufferMemoryDescriptor.h>
92#include <IOKit/IOCatalogue.h>
93#include <IOKit/IOCommand.h>
94#include <IOKit/IOCommandGate.h>
95#include <IOKit/IOCommandPool.h>
96#include <IOKit/IOCommandQueue.h>
97#include <IOKit/IOConditionLock.h>
98#include <IOKit/IOCPU.h>
99//#include <IOKit/IODataQueue.h>
100#include <IOKit/IODataQueueShared.h>
101#include <IOKit/IODeviceMemory.h>
102#include <IOKit/IODeviceTreeSupport.h>
103#include <IOKit/IODMACommand.h>
104#include <IOKit/IODMAController.h>
105#include <IOKit/IODMAEventSource.h>
106#include <IOKit/IOEventSource.h>
107#include <IOKit/IOFilterInterruptEventSource.h>
108#include <IOKit/IOHibernatePrivate.h>
109#include <IOKit/IOInterleavedMemoryDescriptor.h>
110#include <IOKit/IOInterruptAccounting.h>
111#include <IOKit/IOInterruptAccountingPrivate.h>
112#include <IOKit/IOInterruptController.h>
113#include <IOKit/IOInterruptEventSource.h>
114#include <IOKit/IOInterrupts.h>
115#include <IOKit/IOKernelReporters.h>
116#include <IOKit/IOKernelReportStructs.h>
117#include <IOKit/IOKitDebug.h>
118#include <IOKit/IOKitDiagnosticsUserClient.h>
119#include <IOKit/IOKitKeys.h>
120#include <IOKit/IOKitKeysPrivate.h>
121#include <IOKit/IOKitServer.h>
122#include <IOKit/IOLib.h>
123#include <IOKit/IOLocks.h>
124#include <IOKit/IOLocksPrivate.h>
125#include <IOKit/IOMapper.h>
126#include <IOKit/IOMemoryCursor.h>
127#include <IOKit/IOMemoryDescriptor.h>
128#include <IOKit/IOMessage.h>
129#include <IOKit/IOMultiMemoryDescriptor.h>
130#include <IOKit/IONotifier.h>
131#include <IOKit/IONVRAM.h>
132#include <IOKit/IOPlatformExpert.h>
133#include <IOKit/IOPolledInterface.h>
134#include <IOKit/IORangeAllocator.h>
135#include <IOKit/IORegistryEntry.h>
136#include <IOKit/IOReportMacros.h>
137#include <IOKit/IOReportTypes.h>
138#include <IOKit/IOReturn.h>
139#include <IOKit/IOService.h>
140#include <IOKit/IOServicePM.h>
141#include <IOKit/IOSharedDataQueue.h>
142#include <IOKit/IOSharedLock.h>
143#include <IOKit/IOStatistics.h>
144#include <IOKit/IOStatisticsPrivate.h>
145#include <IOKit/IOSubMemoryDescriptor.h>
146#include <IOKit/IOSyncer.h>
147#include <IOKit/IOTimerEventSource.h>
148#include <IOKit/IOTimeStamp.h>
149#include <IOKit/IOTypes.h>
150#include <IOKit/IOUserClient.h>
151#include <IOKit/IOWorkLoop.h>
152#include <IOKit/nvram/IONVRAMController.h>
153#include <IOKit/OSMessageNotification.h>
154#include <IOKit/platform/AppleMacIO.h>
155#include <IOKit/platform/AppleMacIODevice.h>
156#include <IOKit/platform/AppleNMI.h>
157#include <IOKit/platform/ApplePlatformExpert.h>
158#include <IOKit/power/IOPwrController.h>
159#include <IOKit/pwr_mgt/IOPM.h>
160#include <IOKit/pwr_mgt/IOPMinformee.h>
161#include <IOKit/pwr_mgt/IOPMinformeeList.h>
162#include <IOKit/pwr_mgt/IOPMLibDefs.h>
163#include <IOKit/pwr_mgt/IOPMlog.h>
164#include <IOKit/pwr_mgt/IOPMPowerSource.h>
165#include <IOKit/pwr_mgt/IOPMPowerSourceList.h>
166#include <IOKit/pwr_mgt/IOPMpowerState.h>
167#include <IOKit/pwr_mgt/IOPMPrivate.h>
168#include <IOKit/pwr_mgt/IOPowerConnection.h>
169#include <IOKit/pwr_mgt/RootDomain.h>
170#include <IOKit/rtc/IORTCController.h>
171#include <IOKit/system.h>
172#include <IOKit/system_management/IOWatchDogTimer.h>
173
174#endif /* TEST_HEADERS */
175
176#include <sys/sysctl.h>
177#include <libkern/c++/OSData.h>
178#include "Tests.h"
179
180static int
181sysctl_iokittest(__unused struct sysctl_oid *oidp, __unused void *arg1, __unused int arg2, struct sysctl_req *req)
1c79356b 182{
3e170ce0
A
183 int error;
184 int newValue, changed;
185
186 error = sysctl_io_number(req, 0, sizeof(int), &newValue, &changed);
187 if (error) return (error);
188
189#if DEVELOPMENT || DEBUG
190 if (changed && (999==newValue))
191 {
192 OSData * data = OSData::withCapacity(16);
193 data->release();
194 data->release();
1c79356b
A
195 }
196
3e170ce0
A
197 if (changed && newValue) error = IOMemoryDescriptorTest(newValue);
198#endif /* DEVELOPMENT || DEBUG */
1c79356b 199
3e170ce0 200 return (error);
1c79356b
A
201}
202
3e170ce0
A
203SYSCTL_PROC(_kern, OID_AUTO, iokittest,
204 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NOAUTO | CTLFLAG_KERN | CTLFLAG_LOCKED,
205 0, 0, sysctl_iokittest, "I", "");
1c79356b 206
1c79356b 207