LCOV - code coverage report
Current view: directory - src/trusted/cpu_features/arch/x86 - cpu_x86_test.c (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 21 15 71.4 %
Date: 2014-06-18 Functions: 0 0 -

       1                 : /*
       2                 :  * Copyright (c) 2012 The Native Client Authors. All rights reserved.
       3                 :  * Use of this source code is governed by a BSD-style license that can be
       4                 :  * found in the LICENSE file.
       5                 :  */
       6                 : 
       7                 : #ifndef NACL_TRUSTED_BUT_NOT_TCB
       8                 : #error("This file is not meant for use in the TCB")
       9                 : #endif
      10                 : 
      11                 : /*
      12                 :  * cpu_x86_test.c
      13                 :  * test main and subroutines for cpu_x86
      14                 :  */
      15                 : #include "native_client/src/include/portability.h"
      16                 : #include <stdio.h>
      17                 : #include "native_client/src/trusted/cpu_features/arch/x86/cpu_x86.h"
      18                 : 
      19                 : int main(void) {
      20               1 :   NaClCPUFeaturesX86 fv;
      21               1 :   NaClCPUData cpu_data;
      22               1 :   int feature_id;
      23               1 :   NaClCPUDataGet(&cpu_data);
      24                 : 
      25               1 :   NaClGetCurrentCPUFeaturesX86((NaClCPUFeatures *) &fv);
      26               1 :   if (NaClArchSupportedX86(&fv)) {
      27               1 :     printf("This is a native client %d-bit %s compatible computer\n",
      28               1 :            NACL_TARGET_SUBARCH, GetCPUIDString(&cpu_data));
      29               1 :   } else {
      30               0 :     if (!NaClGetCPUFeatureX86(&fv, NaClCPUFeatureX86_CPUIDSupported)) {
      31               0 :       printf("Computer doesn't support CPUID\n");
      32               0 :     }
      33               0 :     if (!NaClGetCPUFeatureX86(&fv, NaClCPUFeatureX86_CPUSupported)) {
      34               0 :       printf("Computer id %s is not supported\n", GetCPUIDString(&cpu_data));
      35               0 :     }
      36                 :   }
      37                 : 
      38               1 :   printf("This processor has:\n");
      39              78 :   for (feature_id = 0; feature_id < NaClCPUFeatureX86_Max; ++feature_id) {
      40              38 :     if (NaClGetCPUFeatureX86(&fv, feature_id))
      41              21 :       printf("        %s\n", NaClGetCPUFeatureX86Name(feature_id));
      42              38 :   }
      43               1 :   return 0;
      44                 : }

Generated by: LCOV version 1.7