crosvm/tests/plugin_msr_index_list.c
Dennis Kempin 1dab58a2cf Update all copyright headers to match new style
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.

This fulfills the request from legal and unifies our notices.

./tools/health-check has been updated to only accept this style.

BUG=b:246579983
TEST=./tools/health-check

Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-13 18:41:29 +00:00

49 lines
1.2 KiB
C

/*
* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "crosvm.h"
int main(int argc, char** argv) {
struct crosvm *crosvm;
int ret = crosvm_connect(&crosvm);
if (ret) {
fprintf(stderr, "failed to connect to crosvm: %d\n", ret);
return 1;
}
uint32_t msr_indices[256];
int n_entries;
ret = crosvm_get_msr_index_list(crosvm, 1, msr_indices, &n_entries);
if (ret >= 0) {
fprintf(stderr,
"expected crosvm_get_msr_index_list to fail with E2BIG\n");
return 1;
}
memset(msr_indices, 0, sizeof(msr_indices));
ret = crosvm_get_msr_index_list(crosvm, 256, msr_indices, &n_entries);
if (ret < 0) {
fprintf(stderr,
"unexpected failure of crosvm_get_msr_index_list: %d\n", ret);
return 1;
}
if (n_entries <= 1) {
fprintf(stderr,
"unexpected number of supported msr entries: %d\n",
n_entries);
return 1;
}
return 0;
}