LCOV - code coverage report
Current view: directory - src/trusted/validator/x86 - nacl_cpuid_test.c (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 14 10 71.4 %
Date: 2012-02-16 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                 :  * nacl_cpuid_test.c
      13                 :  * test main and subroutines for nacl_cpuid
      14                 :  */
      15                 : #include "native_client/src/include/portability.h"
      16                 : #include <stdio.h>
      17                 : #include "native_client/src/trusted/validator/x86/nacl_cpuid.h"
      18                 : 
      19               1 : int main(int argc, char *argv[]) {
      20                 :   NaClCPUFeaturesX86 fv;
      21                 :   NaClCPUData cpu_data;
      22                 :   int feature_id;
      23               1 :   NaClCPUDataGet(&cpu_data);
      24                 : 
      25               1 :   NaClGetCurrentCPUFeatures(&fv);
      26               1 :   if (NaClArchSupported(&fv)) {
      27               1 :     printf("This is a native client %d-bit %s compatible computer\n",
      28                 :            NACL_TARGET_SUBARCH, GetCPUIDString(&cpu_data));
      29                 :   } else {
      30               0 :     if (!fv.arch_features.f_cpuid_supported) {
      31               0 :       printf("Computer doesn't support CPUID\n");
      32                 :     }
      33               0 :     if (!fv.arch_features.f_cpu_supported) {
      34               0 :       printf("Computer id %s is not supported\n", GetCPUIDString(&cpu_data));
      35                 :     }
      36                 :   }
      37                 : 
      38               1 :   printf("This processor has:\n");
      39              31 :   for (feature_id = 0; feature_id < NaClCPUFeature_Max; ++feature_id) {
      40              30 :     if (NaClGetCPUFeature(&fv, feature_id))
      41              18 :       printf("        %s\n", NaClGetCPUFeatureName(feature_id));
      42                 :   }
      43               1 :   return 0;
      44                 : }

Generated by: LCOV version 1.7