@@ -75,14 +75,12 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
7575 double val , num_cpus_online , num_cpus , num_cores , num_dies , num_packages ;
7676 int ret ;
7777 struct expr_parse_ctx * ctx ;
78- bool is_intel = false;
7978 char strcmp_cpuid_buf [256 ];
8079 struct perf_cpu cpu = {-1 };
8180 char * cpuid = get_cpuid_allow_env_override (cpu );
8281 char * escaped_cpuid1 , * escaped_cpuid2 ;
8382
8483 TEST_ASSERT_VAL ("get_cpuid" , cpuid );
85- is_intel = strstr (cpuid , "Intel" ) != NULL ;
8684
8785 TEST_ASSERT_EQUAL ("ids_union" , test_ids_union (), 0 );
8886
@@ -245,12 +243,19 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
245243 if (num_dies ) // Some platforms do not have CPU die support, for example s390
246244 TEST_ASSERT_VAL ("#num_dies >= #num_packages" , num_dies >= num_packages );
247245
248- TEST_ASSERT_VAL ("#system_tsc_freq" , expr__parse (& val , ctx , "#system_tsc_freq" ) == 0 );
249- if (is_intel )
250- TEST_ASSERT_VAL ("#system_tsc_freq > 0" , val > 0 );
251- else
252- TEST_ASSERT_VAL ("#system_tsc_freq == 0" , fpclassify (val ) == FP_ZERO );
253246
247+ if (expr__parse (& val , ctx , "#system_tsc_freq" ) == 0 ) {
248+ bool is_intel = strstr (cpuid , "Intel" ) != NULL ;
249+
250+ if (is_intel )
251+ TEST_ASSERT_VAL ("#system_tsc_freq > 0" , val > 0 );
252+ else
253+ TEST_ASSERT_VAL ("#system_tsc_freq == 0" , fpclassify (val ) == FP_ZERO );
254+ } else {
255+ #if defined(__i386__ ) || defined(__x86_64__ )
256+ TEST_ASSERT_VAL ("#system_tsc_freq unsupported" , 0 );
257+ #endif
258+ }
254259 /*
255260 * Source count returns the number of events aggregating in a leader
256261 * event including the leader. Check parsing yields an id.
0 commit comments