diff options
author | Frederik Harwath <frederik@codesourcery.com> | 2020-01-29 10:21:18 +0100 |
---|---|---|
committer | Frederik Harwath <frederik@codesourcery.com> | 2020-01-29 11:55:06 +0100 |
commit | 87c3fcfa6bbb5c372d4e275276d21f601d0b62b0 (patch) | |
tree | 479a941b519b35685b6fd5556405dbca023a2673 /libgomp | |
parent | 2e5ea57959183bd5bd0356739bb5167417401a31 (diff) | |
download | gcc-87c3fcfa6bbb5c372d4e275276d21f601d0b62b0.zip gcc-87c3fcfa6bbb5c372d4e275276d21f601d0b62b0.tar.gz gcc-87c3fcfa6bbb5c372d4e275276d21f601d0b62b0.tar.bz2 |
Adjust formatting of acc_get_property tests
libgomp/
* testsuite/libgomp.oacc-c-c++-common/acc_get_property.c:
Adjust to GNU coding style.
* testsuite/libgomp.oacc-c-c++-common/acc_get_property-aux.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_get_property-gcn.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_get_property-host.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_get_property-nvptx.c: Likewise.
Diffstat (limited to 'libgomp')
5 files changed, 60 insertions, 49 deletions
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-aux.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-aux.c index f43f75b..47285fc 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-aux.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-aux.c @@ -7,19 +7,20 @@ #include <string.h> -void expect_device_string_properties (acc_device_t dev_type, int dev_num, - const char* expected_vendor, - const char* expected_name, - const char* expected_driver) +void +expect_device_string_properties (acc_device_t dev_type, int dev_num, + const char* expected_vendor, + const char* expected_name, + const char* expected_driver) { -const char *vendor = acc_get_property_string (dev_num, dev_type, - acc_property_vendor); -if (strcmp (vendor, expected_vendor)) -{ - fprintf (stderr, "Expected acc_property_vendor to equal \"%s\", " - "but was \"%s\".\n", expected_vendor, vendor); - abort (); -} + const char *vendor = acc_get_property_string (dev_num, dev_type, + acc_property_vendor); + if (strcmp (vendor, expected_vendor)) + { + fprintf (stderr, "Expected acc_property_vendor to equal \"%s\", " + "but was \"%s\".\n", expected_vendor, vendor); + abort (); + } const char *name = acc_get_property_string (dev_num, dev_type, acc_property_name); @@ -58,8 +59,9 @@ if (strcmp (vendor, expected_vendor)) } } -void expect_device_memory (acc_device_t dev_type, int dev_num, - size_t expected_total_memory) +void +expect_device_memory (acc_device_t dev_type, int dev_num, + size_t expected_total_memory) { size_t total_mem = acc_get_property (dev_num, dev_type, @@ -83,11 +85,12 @@ void expect_device_memory (acc_device_t dev_type, int dev_num, } } -void expect_device_properties (acc_device_t dev_type, int dev_num, - size_t expected_total_memory, - const char* expected_vendor, - const char* expected_name, - const char* expected_driver) +void +expect_device_properties (acc_device_t dev_type, int dev_num, + size_t expected_total_memory, + const char* expected_vendor, + const char* expected_name, + const char* expected_driver) { expect_device_string_properties (dev_type, dev_num, expected_vendor, expected_name, expected_driver); diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-gcn.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-gcn.c index 059b503..ce59264 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-gcn.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-gcn.c @@ -34,7 +34,8 @@ hsa_status_t (*hsa_init_fn) (void); char* support_cpu_devices; -void test_setup () +void +test_setup () { char* env_runtime; char* hsa_runtime_lib; @@ -68,7 +69,8 @@ void test_setup () support_cpu_devices = getenv ("GCN_SUPPORT_CPU_DEVICES"); } -static hsa_status_t check_agent_properties (hsa_agent_t agent, void *dev_num_arg) +static hsa_status_t +check_agent_properties (hsa_agent_t agent, void *dev_num_arg) { char name[64]; @@ -120,7 +122,8 @@ static hsa_status_t check_agent_properties (hsa_agent_t agent, void *dev_num_arg return status; } -int main () +int +main () { int dev_num = 0; test_setup (); diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-host.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-host.c index f1cd7cf..4ed0dfa 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-host.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-host.c @@ -6,12 +6,14 @@ #include <openacc.h> #include <stdio.h> -void expect_device_properties -(acc_device_t dev_type, int dev_num, - size_t expected_memory, const char* expected_vendor, - const char* expected_name, const char* expected_driver); +void expect_device_properties (acc_device_t dev_type, int dev_num, + size_t expected_memory, + const char* expected_vendor, + const char* expected_name, + const char* expected_driver); -int main() +int +main () { printf ("Checking acc_device_host device properties\n"); expect_device_properties (acc_device_host, 0, 0, "GNU", "GOMP", "1.0"); diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-nvptx.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-nvptx.c index 0dcaea7..6334cfd 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-nvptx.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property-nvptx.c @@ -11,12 +11,14 @@ #include <string.h> #include <stdio.h> -void expect_device_properties -(acc_device_t dev_type, int dev_num, - size_t expected_memory, const char* expected_vendor, - const char* expected_name, const char* expected_driver); +void expect_device_properties (acc_device_t dev_type, int dev_num, + size_t expected_memory, + const char* expected_vendor, + const char* expected_name, + const char* expected_driver); -int main () +int +main () { int dev_count; cudaGetDeviceCount (&dev_count); @@ -29,26 +31,26 @@ int main () abort (); } - printf("Checking device %d\n", dev_num); + printf ("Checking device %d\n", dev_num); const char *vendor = "Nvidia"; size_t free_mem; size_t total_mem; - if (cudaMemGetInfo(&free_mem, &total_mem) != cudaSuccess) + if (cudaMemGetInfo (&free_mem, &total_mem) != cudaSuccess) { fprintf (stderr, "cudaMemGetInfo failed.\n"); abort (); } struct cudaDeviceProp p; - if (cudaGetDeviceProperties(&p, dev_num) != cudaSuccess) + if (cudaGetDeviceProperties (&p, dev_num) != cudaSuccess) { fprintf (stderr, "cudaGetDeviceProperties failed.\n"); abort (); } int driver_version; - if (cudaDriverGetVersion(&driver_version) != cudaSuccess) + if (cudaDriverGetVersion (&driver_version) != cudaSuccess) { fprintf (stderr, "cudaDriverGetVersion failed.\n"); abort (); @@ -63,7 +65,7 @@ int main () /* Note that this check relies on the fact that the device numbering used by the nvptx plugin agrees with the CUDA device ordering. */ - expect_device_properties(acc_device_nvidia, dev_num, - total_mem, vendor, p.name, driver); + expect_device_properties (acc_device_nvidia, dev_num, + total_mem, vendor, p.name, driver); } } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property.c index 1984ad3..3460035 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_get_property.c @@ -14,7 +14,7 @@ and do basic device independent validation. */ void -print_device_properties(acc_device_t type) +print_device_properties (acc_device_t type) { const char *s; size_t v; @@ -23,7 +23,7 @@ print_device_properties(acc_device_t type) for (int i = 0; i < dev_count; ++i) { - printf(" Device %d:\n", i+1); + printf (" Device %d:\n", i+1); s = acc_get_property_string (i, type, acc_property_vendor); printf (" Vendor: %s\n", s); @@ -57,19 +57,20 @@ print_device_properties(acc_device_t type) } } -int main () +int +main () { - printf("acc_device_none:\n"); + printf ("acc_device_none:\n"); /* For completness; not expected to print anything since there should be no devices of this type. */ - print_device_properties(acc_device_none); + print_device_properties (acc_device_none); - printf("acc_device_default:\n"); - print_device_properties(acc_device_default); + printf ("acc_device_default:\n"); + print_device_properties (acc_device_default); - printf("acc_device_host:\n"); - print_device_properties(acc_device_host); + printf ("acc_device_host:\n"); + print_device_properties (acc_device_host); - printf("acc_device_not_host:\n"); - print_device_properties(acc_device_not_host); + printf ("acc_device_not_host:\n"); + print_device_properties (acc_device_not_host); } |