Main.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. /*
  2. * Copyright (C) 2012 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #define ATRACE_TAG ATRACE_TAG_ALWAYS
  17. #include <gui/GraphicBufferAlloc.h>
  18. #include <gui/Surface.h>
  19. #include <gui/SurfaceControl.h>
  20. #include <gui/GLConsumer.h>
  21. #include <gui/Surface.h>
  22. #include <ui/Fence.h>
  23. #include <utils/Trace.h>
  24. #include <EGL/egl.h>
  25. #include <GLES2/gl2.h>
  26. #include <math.h>
  27. #include <getopt.h>
  28. #include "Flatland.h"
  29. #include "GLHelper.h"
  30. using namespace ::android;
  31. static uint32_t g_SleepBetweenSamplesMs = 0;
  32. static bool g_PresentToWindow = false;
  33. static size_t g_BenchmarkNameLen = 0;
  34. struct BenchmarkDesc {
  35. // The name of the test.
  36. const char* name;
  37. // The dimensions of the space in which window layers are specified.
  38. uint32_t width;
  39. uint32_t height;
  40. // The screen heights at which to run the test.
  41. uint32_t runHeights[MAX_TEST_RUNS];
  42. // The list of window layers.
  43. LayerDesc layers[MAX_NUM_LAYERS];
  44. };
  45. static const BenchmarkDesc benchmarks[] = {
  46. { "16:10 Single Static Window",
  47. 2560, 1600, { 800, 1200, 1600, 2400 },
  48. {
  49. { // Window
  50. 0, staticGradient, opaque,
  51. 0, 50, 2560, 1454,
  52. },
  53. { // Status bar
  54. 0, staticGradient, opaque,
  55. 0, 0, 2560, 50,
  56. },
  57. { // Navigation bar
  58. 0, staticGradient, opaque,
  59. 0, 1504, 2560, 96,
  60. },
  61. },
  62. },
  63. { "4:3 Single Static Window",
  64. 2048, 1536, { 1536 },
  65. {
  66. { // Window
  67. 0, staticGradient, opaque,
  68. 0, 50, 2048, 1440,
  69. },
  70. { // Status bar
  71. 0, staticGradient, opaque,
  72. 0, 0, 2048, 50,
  73. },
  74. { // Navigation bar
  75. 0, staticGradient, opaque,
  76. 0, 1440, 2048, 96,
  77. },
  78. },
  79. },
  80. { "16:10 App -> Home Transition",
  81. 2560, 1600, { 800, 1200, 1600, 2400 },
  82. {
  83. { // Wallpaper
  84. 0, staticGradient, opaque,
  85. 0, 50, 2560, 1454,
  86. },
  87. { // Launcher
  88. 0, staticGradient, blend,
  89. 0, 50, 2560, 1454,
  90. },
  91. { // Outgoing activity
  92. 0, staticGradient, blendShrink,
  93. 20, 70, 2520, 1414,
  94. },
  95. { // Status bar
  96. 0, staticGradient, opaque,
  97. 0, 0, 2560, 50,
  98. },
  99. { // Navigation bar
  100. 0, staticGradient, opaque,
  101. 0, 1504, 2560, 96,
  102. },
  103. },
  104. },
  105. { "4:3 App -> Home Transition",
  106. 2048, 1536, { 1536 },
  107. {
  108. { // Wallpaper
  109. 0, staticGradient, opaque,
  110. 0, 50, 2048, 1440,
  111. },
  112. { // Launcher
  113. 0, staticGradient, blend,
  114. 0, 50, 2048, 1440,
  115. },
  116. { // Outgoing activity
  117. 0, staticGradient, blendShrink,
  118. 20, 70, 2048, 1400,
  119. },
  120. { // Status bar
  121. 0, staticGradient, opaque,
  122. 0, 0, 2048, 50,
  123. },
  124. { // Navigation bar
  125. 0, staticGradient, opaque,
  126. 0, 1440, 2048, 96,
  127. },
  128. },
  129. },
  130. { "16:10 SurfaceView -> Home Transition",
  131. 2560, 1600, { 800, 1200, 1600, 2400 },
  132. {
  133. { // Wallpaper
  134. 0, staticGradient, opaque,
  135. 0, 50, 2560, 1454,
  136. },
  137. { // Launcher
  138. 0, staticGradient, blend,
  139. 0, 50, 2560, 1454,
  140. },
  141. { // Outgoing SurfaceView
  142. 0, staticGradient, blendShrink,
  143. 20, 70, 2520, 1414,
  144. },
  145. { // Outgoing activity
  146. 0, staticGradient, blendShrink,
  147. 20, 70, 2520, 1414,
  148. },
  149. { // Status bar
  150. 0, staticGradient, opaque,
  151. 0, 0, 2560, 50,
  152. },
  153. { // Navigation bar
  154. 0, staticGradient, opaque,
  155. 0, 1504, 2560, 96,
  156. },
  157. },
  158. },
  159. { "4:3 SurfaceView -> Home Transition",
  160. 2048, 1536, { 1536 },
  161. {
  162. { // Wallpaper
  163. 0, staticGradient, opaque,
  164. 0, 50, 2048, 1440,
  165. },
  166. { // Launcher
  167. 0, staticGradient, blend,
  168. 0, 50, 2048, 1440,
  169. },
  170. { // Outgoing SurfaceView
  171. 0, staticGradient, blendShrink,
  172. 20, 70, 2048, 1400,
  173. },
  174. { // Outgoing activity
  175. 0, staticGradient, blendShrink,
  176. 20, 70, 2048, 1400,
  177. },
  178. { // Status bar
  179. 0, staticGradient, opaque,
  180. 0, 0, 2048, 50,
  181. },
  182. { // Navigation bar
  183. 0, staticGradient, opaque,
  184. 0, 1440, 2048, 96,
  185. },
  186. },
  187. },
  188. };
  189. static const ShaderDesc shaders[] = {
  190. {
  191. name: "Blit",
  192. vertexShader: {
  193. "precision mediump float;",
  194. "",
  195. "attribute vec4 position;",
  196. "attribute vec4 uv;",
  197. "",
  198. "varying vec4 texCoords;",
  199. "",
  200. "uniform mat4 objToNdc;",
  201. "uniform mat4 uvToTex;",
  202. "",
  203. "void main() {",
  204. " gl_Position = objToNdc * position;",
  205. " texCoords = uvToTex * uv;",
  206. "}",
  207. },
  208. fragmentShader: {
  209. "#extension GL_OES_EGL_image_external : require",
  210. "precision mediump float;",
  211. "",
  212. "varying vec4 texCoords;",
  213. "",
  214. "uniform samplerExternalOES blitSrc;",
  215. "uniform vec4 modColor;",
  216. "",
  217. "void main() {",
  218. " gl_FragColor = texture2D(blitSrc, texCoords.xy);",
  219. " gl_FragColor *= modColor;",
  220. "}",
  221. },
  222. },
  223. {
  224. name: "Gradient",
  225. vertexShader: {
  226. "precision mediump float;",
  227. "",
  228. "attribute vec4 position;",
  229. "attribute vec4 uv;",
  230. "",
  231. "varying float interp;",
  232. "",
  233. "uniform mat4 objToNdc;",
  234. "uniform mat4 uvToInterp;",
  235. "",
  236. "void main() {",
  237. " gl_Position = objToNdc * position;",
  238. " interp = (uvToInterp * uv).x;",
  239. "}",
  240. },
  241. fragmentShader: {
  242. "precision mediump float;",
  243. "",
  244. "varying float interp;",
  245. "",
  246. "uniform vec4 color0;",
  247. "uniform vec4 color1;",
  248. "",
  249. "uniform sampler2D ditherKernel;",
  250. "uniform float invDitherKernelSize;",
  251. "uniform float invDitherKernelSizeSq;",
  252. "",
  253. "void main() {",
  254. " float dither = texture2D(ditherKernel,",
  255. " gl_FragCoord.xy * invDitherKernelSize).a;",
  256. " dither *= invDitherKernelSizeSq;",
  257. " vec4 color = mix(color0, color1, clamp(interp, 0.0, 1.0));",
  258. " gl_FragColor = color + vec4(dither, dither, dither, 0.0);",
  259. "}",
  260. },
  261. },
  262. };
  263. class Layer {
  264. public:
  265. Layer() :
  266. mFirstFrame(true),
  267. mGLHelper(NULL),
  268. mSurface(EGL_NO_SURFACE) {
  269. }
  270. bool setUp(const LayerDesc& desc, GLHelper* helper) {
  271. bool result;
  272. mDesc = desc;
  273. mGLHelper = helper;
  274. result = mGLHelper->createSurfaceTexture(mDesc.width, mDesc.height,
  275. &mGLConsumer, &mSurface, &mTexName);
  276. if (!result) {
  277. return false;
  278. }
  279. mRenderer = desc.rendererFactory();
  280. result = mRenderer->setUp(helper);
  281. if (!result) {
  282. return false;
  283. }
  284. mComposer = desc.composerFactory();
  285. result = mComposer->setUp(desc, helper);
  286. if (!result) {
  287. return false;
  288. }
  289. return true;
  290. }
  291. void tearDown() {
  292. if (mComposer != NULL) {
  293. mComposer->tearDown();
  294. delete mComposer;
  295. mComposer = NULL;
  296. }
  297. if (mRenderer != NULL) {
  298. mRenderer->tearDown();
  299. delete mRenderer;
  300. mRenderer = NULL;
  301. }
  302. if (mSurface != EGL_NO_SURFACE) {
  303. mGLHelper->destroySurface(&mSurface);
  304. mGLConsumer->abandon();
  305. }
  306. mGLHelper = NULL;
  307. mGLConsumer.clear();
  308. }
  309. bool render() {
  310. return mRenderer->render(mSurface);
  311. }
  312. bool prepareComposition() {
  313. status_t err;
  314. err = mGLConsumer->updateTexImage();
  315. if (err < 0) {
  316. fprintf(stderr, "GLConsumer::updateTexImage error: %d\n", err);
  317. return false;
  318. }
  319. return true;
  320. }
  321. bool compose() {
  322. return mComposer->compose(mTexName, mGLConsumer);
  323. }
  324. private:
  325. bool mFirstFrame;
  326. LayerDesc mDesc;
  327. GLHelper* mGLHelper;
  328. GLuint mTexName;
  329. sp<GLConsumer> mGLConsumer;
  330. EGLSurface mSurface;
  331. Renderer* mRenderer;
  332. Composer* mComposer;
  333. };
  334. class BenchmarkRunner {
  335. public:
  336. BenchmarkRunner(const BenchmarkDesc& desc, size_t instance) :
  337. mDesc(desc),
  338. mInstance(instance),
  339. mNumLayers(countLayers(desc)),
  340. mGLHelper(NULL),
  341. mSurface(EGL_NO_SURFACE),
  342. mWindowSurface(EGL_NO_SURFACE) {
  343. }
  344. bool setUp() {
  345. ATRACE_CALL();
  346. bool result;
  347. EGLint resulte;
  348. float scaleFactor = float(mDesc.runHeights[mInstance]) /
  349. float(mDesc.height);
  350. uint32_t w = uint32_t(scaleFactor * float(mDesc.width));
  351. uint32_t h = mDesc.runHeights[mInstance];
  352. mGLHelper = new GLHelper();
  353. result = mGLHelper->setUp(shaders, NELEMS(shaders));
  354. if (!result) {
  355. return false;
  356. }
  357. GLuint texName;
  358. result = mGLHelper->createSurfaceTexture(w, h, &mGLConsumer, &mSurface,
  359. &texName);
  360. if (!result) {
  361. return false;
  362. }
  363. for (size_t i = 0; i < mNumLayers; i++) {
  364. // Scale the layer to match the current screen size.
  365. LayerDesc ld = mDesc.layers[i];
  366. ld.x = int32_t(scaleFactor * float(ld.x));
  367. ld.y = int32_t(scaleFactor * float(ld.y));
  368. ld.width = uint32_t(scaleFactor * float(ld.width));
  369. ld.height = uint32_t(scaleFactor * float(ld.height));
  370. // Set up the layer.
  371. result = mLayers[i].setUp(ld, mGLHelper);
  372. if (!result) {
  373. return false;
  374. }
  375. }
  376. if (g_PresentToWindow) {
  377. result = mGLHelper->createWindowSurface(w, h, &mSurfaceControl,
  378. &mWindowSurface);
  379. if (!result) {
  380. return false;
  381. }
  382. result = doFrame(mWindowSurface);
  383. if (!result) {
  384. return false;
  385. }
  386. }
  387. return true;
  388. }
  389. void tearDown() {
  390. ATRACE_CALL();
  391. for (size_t i = 0; i < mNumLayers; i++) {
  392. mLayers[i].tearDown();
  393. }
  394. if (mGLHelper != NULL) {
  395. if (mWindowSurface != EGL_NO_SURFACE) {
  396. mGLHelper->destroySurface(&mWindowSurface);
  397. }
  398. mGLHelper->destroySurface(&mSurface);
  399. mGLConsumer->abandon();
  400. mGLConsumer.clear();
  401. mSurfaceControl.clear();
  402. mGLHelper->tearDown();
  403. delete mGLHelper;
  404. mGLHelper = NULL;
  405. }
  406. }
  407. nsecs_t run(uint32_t warmUpFrames, uint32_t totalFrames) {
  408. ATRACE_CALL();
  409. bool result;
  410. status_t err;
  411. resetColorGenerator();
  412. // Do the warm-up frames.
  413. for (uint32_t i = 0; i < warmUpFrames; i++) {
  414. result = doFrame(mSurface);
  415. if (!result) {
  416. return -1;
  417. }
  418. }
  419. // Grab the fence for the start timestamp.
  420. sp<Fence> startFence = mGLConsumer->getCurrentFence();
  421. // the timed frames.
  422. for (uint32_t i = warmUpFrames; i < totalFrames; i++) {
  423. result = doFrame(mSurface);
  424. if (!result) {
  425. return -1;
  426. }
  427. }
  428. // Grab the fence for the end timestamp.
  429. sp<Fence> endFence = mGLConsumer->getCurrentFence();
  430. // Keep doing frames until the end fence has signaled.
  431. while (endFence->wait(0) == -ETIME) {
  432. result = doFrame(mSurface);
  433. if (!result) {
  434. return -1;
  435. }
  436. }
  437. // Compute the time delta.
  438. nsecs_t startTime = startFence->getSignalTime();
  439. nsecs_t endTime = endFence->getSignalTime();
  440. return endTime - startTime;
  441. }
  442. private:
  443. bool doFrame(EGLSurface surface) {
  444. bool result;
  445. status_t err;
  446. for (size_t i = 0; i < mNumLayers; i++) {
  447. result = mLayers[i].render();
  448. if (!result) {
  449. return false;
  450. }
  451. }
  452. for (size_t i = 0; i < mNumLayers; i++) {
  453. result = mLayers[i].prepareComposition();
  454. if (!result) {
  455. return false;
  456. }
  457. }
  458. result = mGLHelper->makeCurrent(surface);
  459. if (!result) {
  460. return false;
  461. }
  462. glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
  463. glClear(GL_COLOR_BUFFER_BIT);
  464. for (size_t i = 0; i < mNumLayers; i++) {
  465. result = mLayers[i].compose();
  466. if (!result) {
  467. return false;
  468. }
  469. }
  470. result = mGLHelper->swapBuffers(surface);
  471. if (!result) {
  472. return false;
  473. }
  474. err = mGLConsumer->updateTexImage();
  475. if (err < 0) {
  476. fprintf(stderr, "GLConsumer::updateTexImage error: %d\n", err);
  477. return false;
  478. }
  479. return true;
  480. }
  481. static size_t countLayers(const BenchmarkDesc& desc) {
  482. size_t i;
  483. for (i = 0; i < MAX_NUM_LAYERS; i++) {
  484. if (desc.layers[i].rendererFactory == NULL) {
  485. break;
  486. }
  487. }
  488. return i;
  489. }
  490. const BenchmarkDesc& mDesc;
  491. const size_t mInstance;
  492. const size_t mNumLayers;
  493. GLHelper* mGLHelper;
  494. // The surface into which layers are composited
  495. sp<GLConsumer> mGLConsumer;
  496. EGLSurface mSurface;
  497. // Used for displaying the surface to a window.
  498. EGLSurface mWindowSurface;
  499. sp<SurfaceControl> mSurfaceControl;
  500. Layer mLayers[MAX_NUM_LAYERS];
  501. };
  502. static int cmpDouble(const double* lhs, const double* rhs) {
  503. if (*lhs < *rhs) {
  504. return -1;
  505. } else if (*rhs < *lhs) {
  506. return 1;
  507. }
  508. return 0;
  509. }
  510. // Run a single benchmark and print the result.
  511. static bool runTest(const BenchmarkDesc b, size_t run) {
  512. bool success = true;
  513. double prevResult = 0.0, result = 0.0;
  514. Vector<double> samples;
  515. uint32_t runHeight = b.runHeights[run];
  516. uint32_t runWidth = b.width * runHeight / b.height;
  517. printf(" %-*s | %4d x %4d | ", static_cast<int>(g_BenchmarkNameLen), b.name,
  518. runWidth, runHeight);
  519. fflush(stdout);
  520. BenchmarkRunner r(b, run);
  521. if (!r.setUp()) {
  522. fprintf(stderr, "error initializing runner.\n");
  523. return false;
  524. }
  525. // The slowest 1/outlierFraction sample results are ignored as potential
  526. // outliers.
  527. const uint32_t outlierFraction = 16;
  528. const double threshold = .0025;
  529. uint32_t warmUpFrames = 1;
  530. uint32_t totalFrames = 5;
  531. // Find the number of frames needed to run for over 100ms.
  532. double runTime = 0.0;
  533. while (true) {
  534. runTime = double(r.run(warmUpFrames, totalFrames));
  535. if (runTime < 50e6) {
  536. warmUpFrames *= 2;
  537. totalFrames *= 2;
  538. } else {
  539. break;
  540. }
  541. }
  542. if (totalFrames - warmUpFrames > 16) {
  543. // The test runs too fast to get a stable result. Skip it.
  544. printf(" fast");
  545. goto done;
  546. } else if (totalFrames == 5 && runTime > 200e6) {
  547. // The test runs too slow to be very useful. Skip it.
  548. printf(" slow");
  549. goto done;
  550. }
  551. do {
  552. size_t newSamples = samples.size();
  553. if (newSamples == 0) {
  554. newSamples = 4*outlierFraction;
  555. }
  556. if (newSamples > 512) {
  557. printf("varies");
  558. goto done;
  559. }
  560. for (size_t i = 0; i < newSamples; i++) {
  561. double sample = double(r.run(warmUpFrames, totalFrames));
  562. if (g_SleepBetweenSamplesMs > 0) {
  563. usleep(g_SleepBetweenSamplesMs * 1000);
  564. }
  565. if (sample < 0.0) {
  566. success = false;
  567. goto done;
  568. }
  569. samples.add(sample);
  570. }
  571. samples.sort(cmpDouble);
  572. prevResult = result;
  573. size_t elem = (samples.size() * (outlierFraction-1) / outlierFraction);
  574. result = (samples[elem-1] + samples[elem]) * 0.5;
  575. } while (fabs(result - prevResult) > threshold * result);
  576. printf("%6.3f", result / double(totalFrames - warmUpFrames) / 1e6);
  577. done:
  578. printf("\n");
  579. fflush(stdout);
  580. r.tearDown();
  581. return success;
  582. }
  583. static void printResultsTableHeader() {
  584. const char* scenario = "Scenario";
  585. size_t len = strlen(scenario);
  586. size_t leftPad = (g_BenchmarkNameLen - len) / 2;
  587. size_t rightPad = g_BenchmarkNameLen - len - leftPad;
  588. printf(" %*s%s%*s | Resolution | Time (ms)\n",
  589. static_cast<int>(leftPad), "",
  590. "Scenario", static_cast<int>(rightPad), "");
  591. }
  592. // Run ALL the benchmarks!
  593. static bool runTests() {
  594. printResultsTableHeader();
  595. for (size_t i = 0; i < NELEMS(benchmarks); i++) {
  596. const BenchmarkDesc& b = benchmarks[i];
  597. for (size_t j = 0; j < MAX_TEST_RUNS && b.runHeights[j]; j++) {
  598. if (!runTest(b, j)) {
  599. return false;
  600. }
  601. }
  602. }
  603. return true;
  604. }
  605. // Return the length longest benchmark name.
  606. static size_t maxBenchmarkNameLen() {
  607. size_t maxLen = 0;
  608. for (size_t i = 0; i < NELEMS(benchmarks); i++) {
  609. const BenchmarkDesc& b = benchmarks[i];
  610. size_t len = strlen(b.name);
  611. if (len > maxLen) {
  612. maxLen = len;
  613. }
  614. }
  615. return maxLen;
  616. }
  617. // Print the command usage help to stderr.
  618. static void showHelp(const char *cmd) {
  619. fprintf(stderr, "usage: %s [options]\n", cmd);
  620. fprintf(stderr, "options include:\n"
  621. " -s N sleep for N ms between samples\n"
  622. " -d display the test frame to a window\n"
  623. " --help print this helpful message and exit\n"
  624. );
  625. }
  626. int main(int argc, char** argv) {
  627. if (argc == 2 && 0 == strcmp(argv[1], "--help")) {
  628. showHelp(argv[0]);
  629. exit(0);
  630. }
  631. for (;;) {
  632. int ret;
  633. int option_index = 0;
  634. static struct option long_options[] = {
  635. {"help", no_argument, 0, 0 },
  636. { 0, 0, 0, 0 }
  637. };
  638. ret = getopt_long(argc, argv, "ds:",
  639. long_options, &option_index);
  640. if (ret < 0) {
  641. break;
  642. }
  643. switch(ret) {
  644. case 'd':
  645. g_PresentToWindow = true;
  646. break;
  647. case 's':
  648. g_SleepBetweenSamplesMs = atoi(optarg);
  649. break;
  650. case 0:
  651. if (strcmp(long_options[option_index].name, "help")) {
  652. showHelp(argv[0]);
  653. exit(0);
  654. }
  655. break;
  656. default:
  657. showHelp(argv[0]);
  658. exit(2);
  659. }
  660. }
  661. g_BenchmarkNameLen = maxBenchmarkNameLen();
  662. printf(" cmdline:");
  663. for (int i = 0; i < argc; i++) {
  664. printf(" %s", argv[i]);
  665. }
  666. printf("\n");
  667. if (!runTests()) {
  668. fprintf(stderr, "exiting due to error.\n");
  669. return 1;
  670. }
  671. }