[DTrace-devel] [PATCH v2] Ensure stable testing criteria for profile-n basic tests

Eugene Loh eugene.loh at oracle.com
Tue Sep 29 22:45:37 PDT 2020


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
though a few comments below.

On 09/29/2020 09:33 PM, Kris Van Hees wrote:
> The test/unittest/profile-n/tst.profile*.d test cases were written
> to generate output that was compared with expected output.  They all
> followed the same basic template:
>
> 	profile-<spec>
> 	{
> 		printf("<string>");
> 		exit(0);
> 	}
>
> The assumption was that only a single instance of the <string> would
> be seen in the output.  This assumption is based on a bug in the
> exit() action implementation where any exit() action executed from any
> clause *after* an initial exit() was already executed would result in
> any and all trace data from that clause to be dropped.

I'm not sure how many people would understand this.  How about:

     The assumption was that only a single instance of the string would
     be seen in the output.  Meanwhile, profile-n fires on multiple CPUs at
     once, and it is possible multiple such probes may fire before any 
exit()
     action occurs.  So it is possible for the string to be printed 
multiple times.
     A long-standing (since Solaris) DTrace bug suppressed this possible
     behavior (so that tests would pass consistently) until very recently.

That's still a little enigmatic for the interested reader, but I think it's
clearer.

> Given that these tests merely verify that the profile-<spec> probe name
> is valid and results in a successful probing session, there is no need
> to output any data.  If the dtrace command completes successfully with
> return code 0, the test succeeded.

Agreed.  FWIW, more stringent tests would make sense (I have one 
somewhere from profile provider work), but that can be the subject of 
another patch.

> The tst.basic.d test (and result file) have been removed because the
> test is a duplicate of tst.profilenhz.d.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   test/unittest/profile-n/tst.basic.d       | 25 -----------------------
>   test/unittest/profile-n/tst.basic.r       |  2 --
>   test/unittest/profile-n/tst.profilehz.d   |  2 --
>   test/unittest/profile-n/tst.profilehz.r   |  1 -
>   test/unittest/profile-n/tst.profilems.d   |  2 --
>   test/unittest/profile-n/tst.profilems.r   |  1 -
>   test/unittest/profile-n/tst.profilemsec.d |  2 --
>   test/unittest/profile-n/tst.profilemsec.r |  1 -
>   test/unittest/profile-n/tst.profilenhz.d  |  2 --
>   test/unittest/profile-n/tst.profilenhz.r  |  1 -
>   test/unittest/profile-n/tst.profilens.d   |  2 --
>   test/unittest/profile-n/tst.profilens.r   |  1 -
>   test/unittest/profile-n/tst.profilensec.d |  2 --
>   test/unittest/profile-n/tst.profilensec.r |  1 -
>   test/unittest/profile-n/tst.profiles.d    |  2 --
>   test/unittest/profile-n/tst.profiles.r    |  1 -
>   test/unittest/profile-n/tst.profilesec.d  |  2 --
>   test/unittest/profile-n/tst.profilesec.r  |  1 -
>   test/unittest/profile-n/tst.profileus.d   |  2 --
>   test/unittest/profile-n/tst.profileus.r   |  1 -
>   test/unittest/profile-n/tst.profileusec.d |  2 --
>   test/unittest/profile-n/tst.profileusec.r |  1 -
>   22 files changed, 57 deletions(-)
>   delete mode 100644 test/unittest/profile-n/tst.basic.d
>   delete mode 100644 test/unittest/profile-n/tst.basic.r
>   delete mode 100644 test/unittest/profile-n/tst.profilehz.r
>   delete mode 100644 test/unittest/profile-n/tst.profilems.r
>   delete mode 100644 test/unittest/profile-n/tst.profilemsec.r
>   delete mode 100644 test/unittest/profile-n/tst.profilenhz.r
>   delete mode 100644 test/unittest/profile-n/tst.profilens.r
>   delete mode 100644 test/unittest/profile-n/tst.profilensec.r
>   delete mode 100644 test/unittest/profile-n/tst.profiles.r
>   delete mode 100644 test/unittest/profile-n/tst.profilesec.r
>   delete mode 100644 test/unittest/profile-n/tst.profileus.r
>   delete mode 100644 test/unittest/profile-n/tst.profileusec.r
>
> diff --git a/test/unittest/profile-n/tst.basic.d b/test/unittest/profile-n/tst.basic.d
> deleted file mode 100644
> index 876ec19a..00000000
> --- a/test/unittest/profile-n/tst.basic.d
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/*
> - * Oracle Linux DTrace.
> - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
> - * Licensed under the Universal Permissive License v 1.0 as shown at
> - * http://oss.oracle.com/licenses/upl.
> - */
> -/* @@xfail: dtv2 */
> -
> -/*
> - * ASSERTION:
> - *
> - * profile-n simple test.
> - *
> - * SECTION: profile Provider/profile-n probes
> - *
> - */
> -
> -
> -#pragma D option quiet
> -
> -profile-1
> -{
> -	printf("This test is a simple profile-n provider test\n");
> -	exit(0);
> -}
> diff --git a/test/unittest/profile-n/tst.basic.r b/test/unittest/profile-n/tst.basic.r
> deleted file mode 100644
> index 09005bbb..00000000
> --- a/test/unittest/profile-n/tst.basic.r
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -This test is a simple profile-n provider test
> -
> diff --git a/test/unittest/profile-n/tst.profilehz.d b/test/unittest/profile-n/tst.profilehz.d
> index 1de623e8..c2780965 100644
> --- a/test/unittest/profile-n/tst.profilehz.d
> +++ b/test/unittest/profile-n/tst.profilehz.d
> @@ -4,7 +4,6 @@
>    * Licensed under the Universal Permissive License v 1.0 as shown at
>    * http://oss.oracle.com/licenses/upl.
>    */
> -/* @@xfail: dtv2 */
>   
>   /*
>    * ASSERTION:
> @@ -20,6 +19,5 @@
>   
>   profile-100hz
>   {
> -	printf("This test is a simple profile-hz provider test");
>   	exit(0);
>   }
> diff --git a/test/unittest/profile-n/tst.profilehz.r b/test/unittest/profile-n/tst.profilehz.r
> deleted file mode 100644
> index 711f635b..00000000
> --- a/test/unittest/profile-n/tst.profilehz.r
> +++ /dev/null
> @@ -1 +0,0 @@
> -This test is a simple profile-hz provider test
> diff --git a/test/unittest/profile-n/tst.profilems.d b/test/unittest/profile-n/tst.profilems.d
> index f0f21c9b..641d3524 100644
> --- a/test/unittest/profile-n/tst.profilems.d
> +++ b/test/unittest/profile-n/tst.profilems.d
> @@ -4,7 +4,6 @@
>    * Licensed under the Universal Permissive License v 1.0 as shown at
>    * http://oss.oracle.com/licenses/upl.
>    */
> -/* @@xfail: dtv2 */
>   
>   /*
>    * ASSERTION:
> @@ -20,6 +19,5 @@
>   
>   profile-1ms
>   {
> -	printf("This test is a simple profile-ms provider test");
>   	exit(0);
>   }
> diff --git a/test/unittest/profile-n/tst.profilems.r b/test/unittest/profile-n/tst.profilems.r
> deleted file mode 100644
> index 1fe17e7c..00000000
> --- a/test/unittest/profile-n/tst.profilems.r
> +++ /dev/null
> @@ -1 +0,0 @@
> -This test is a simple profile-ms provider test
> diff --git a/test/unittest/profile-n/tst.profilemsec.d b/test/unittest/profile-n/tst.profilemsec.d
> index 557fb6a6..04e06550 100644
> --- a/test/unittest/profile-n/tst.profilemsec.d
> +++ b/test/unittest/profile-n/tst.profilemsec.d
> @@ -4,7 +4,6 @@
>    * Licensed under the Universal Permissive License v 1.0 as shown at
>    * http://oss.oracle.com/licenses/upl.
>    */
> -/* @@xfail: dtv2 */
>   
>   /*
>    * ASSERTION:
> @@ -20,6 +19,5 @@
>   
>   profile-1msec
>   {
> -	printf("This test is a simple profile-msec provider test");
>   	exit(0);
>   }
> diff --git a/test/unittest/profile-n/tst.profilemsec.r b/test/unittest/profile-n/tst.profilemsec.r
> deleted file mode 100644
> index c3fb4a3b..00000000
> --- a/test/unittest/profile-n/tst.profilemsec.r
> +++ /dev/null
> @@ -1 +0,0 @@
> -This test is a simple profile-msec provider test
> diff --git a/test/unittest/profile-n/tst.profilenhz.d b/test/unittest/profile-n/tst.profilenhz.d
> index beb5a3b8..79834720 100644
> --- a/test/unittest/profile-n/tst.profilenhz.d
> +++ b/test/unittest/profile-n/tst.profilenhz.d
> @@ -4,7 +4,6 @@
>    * Licensed under the Universal Permissive License v 1.0 as shown at
>    * http://oss.oracle.com/licenses/upl.
>    */
> -/* @@xfail: dtv2 */
>   
>   /*
>    * ASSERTION:
> @@ -20,6 +19,5 @@
>   
>   profile-100
>   {
> -	printf("This test is a simple profile implicit hz test");
>   	exit(0);
>   }
> diff --git a/test/unittest/profile-n/tst.profilenhz.r b/test/unittest/profile-n/tst.profilenhz.r
> deleted file mode 100644
> index c9409ce5..00000000
> --- a/test/unittest/profile-n/tst.profilenhz.r
> +++ /dev/null
> @@ -1 +0,0 @@
> -This test is a simple profile implicit hz test
> diff --git a/test/unittest/profile-n/tst.profilens.d b/test/unittest/profile-n/tst.profilens.d
> index 91009f4a..0bf4210f 100644
> --- a/test/unittest/profile-n/tst.profilens.d
> +++ b/test/unittest/profile-n/tst.profilens.d
> @@ -4,7 +4,6 @@
>    * Licensed under the Universal Permissive License v 1.0 as shown at
>    * http://oss.oracle.com/licenses/upl.
>    */
> -/* @@xfail: dtv2 */
>   
>   /*
>    * ASSERTION:
> @@ -20,6 +19,5 @@
>   
>   profile-2000000000ns
>   {
> -	printf("This test is a simple profile-ns provider test");
>   	exit(0);
>   }
> diff --git a/test/unittest/profile-n/tst.profilens.r b/test/unittest/profile-n/tst.profilens.r
> deleted file mode 100644
> index 86251d01..00000000
> --- a/test/unittest/profile-n/tst.profilens.r
> +++ /dev/null
> @@ -1 +0,0 @@
> -This test is a simple profile-ns provider test
> diff --git a/test/unittest/profile-n/tst.profilensec.d b/test/unittest/profile-n/tst.profilensec.d
> index e6fe7604..c2955062 100644
> --- a/test/unittest/profile-n/tst.profilensec.d
> +++ b/test/unittest/profile-n/tst.profilensec.d
> @@ -4,7 +4,6 @@
>    * Licensed under the Universal Permissive License v 1.0 as shown at
>    * http://oss.oracle.com/licenses/upl.
>    */
> -/* @@xfail: dtv2 */
>   
>   /*
>    * ASSERTION:
> @@ -20,6 +19,5 @@
>   
>   profile-2000000000nsec
>   {
> -	printf("This test is a simple profile-nsec provider test");
>   	exit(0);
>   }
> diff --git a/test/unittest/profile-n/tst.profilensec.r b/test/unittest/profile-n/tst.profilensec.r
> deleted file mode 100644
> index 890b769d..00000000
> --- a/test/unittest/profile-n/tst.profilensec.r
> +++ /dev/null
> @@ -1 +0,0 @@
> -This test is a simple profile-nsec provider test
> diff --git a/test/unittest/profile-n/tst.profiles.d b/test/unittest/profile-n/tst.profiles.d
> index af0f00db..b6d4701e 100644
> --- a/test/unittest/profile-n/tst.profiles.d
> +++ b/test/unittest/profile-n/tst.profiles.d
> @@ -4,7 +4,6 @@
>    * Licensed under the Universal Permissive License v 1.0 as shown at
>    * http://oss.oracle.com/licenses/upl.
>    */
> -/* @@xfail: dtv2 */
>   
>   /*
>    * ASSERTION:
> @@ -20,6 +19,5 @@
>   
>   profile-1s
>   {
> -	printf("This test is a simple profile-s provider test");
>   	exit(0);
>   }
> diff --git a/test/unittest/profile-n/tst.profiles.r b/test/unittest/profile-n/tst.profiles.r
> deleted file mode 100644
> index 03a0cf22..00000000
> --- a/test/unittest/profile-n/tst.profiles.r
> +++ /dev/null
> @@ -1 +0,0 @@
> -This test is a simple profile-s provider test
> diff --git a/test/unittest/profile-n/tst.profilesec.d b/test/unittest/profile-n/tst.profilesec.d
> index 5f5787f6..74a6e57e 100644
> --- a/test/unittest/profile-n/tst.profilesec.d
> +++ b/test/unittest/profile-n/tst.profilesec.d
> @@ -4,7 +4,6 @@
>    * Licensed under the Universal Permissive License v 1.0 as shown at
>    * http://oss.oracle.com/licenses/upl.
>    */
> -/* @@xfail: dtv2 */
>   
>   /*
>    * ASSERTION:
> @@ -20,6 +19,5 @@
>   
>   profile-1sec
>   {
> -	printf("This test is a simple profile-sec provider test");
>   	exit(0);
>   }
> diff --git a/test/unittest/profile-n/tst.profilesec.r b/test/unittest/profile-n/tst.profilesec.r
> deleted file mode 100644
> index 9091592d..00000000
> --- a/test/unittest/profile-n/tst.profilesec.r
> +++ /dev/null
> @@ -1 +0,0 @@
> -This test is a simple profile-sec provider test
> diff --git a/test/unittest/profile-n/tst.profileus.d b/test/unittest/profile-n/tst.profileus.d
> index bbd4a77e..ea4cf1f5 100644
> --- a/test/unittest/profile-n/tst.profileus.d
> +++ b/test/unittest/profile-n/tst.profileus.d
> @@ -4,7 +4,6 @@
>    * Licensed under the Universal Permissive License v 1.0 as shown at
>    * http://oss.oracle.com/licenses/upl.
>    */
> -/* @@xfail: dtv2 */
>   
>   /*
>    * ASSERTION:
> @@ -20,6 +19,5 @@
>   
>   profile-200us
>   {
> -	printf("This test is a simple profile-us provider test");
>   	exit(0);
>   }
> diff --git a/test/unittest/profile-n/tst.profileus.r b/test/unittest/profile-n/tst.profileus.r
> deleted file mode 100644
> index aa270642..00000000
> --- a/test/unittest/profile-n/tst.profileus.r
> +++ /dev/null
> @@ -1 +0,0 @@
> -This test is a simple profile-us provider test
> diff --git a/test/unittest/profile-n/tst.profileusec.d b/test/unittest/profile-n/tst.profileusec.d
> index e29335c4..8cc43c09 100644
> --- a/test/unittest/profile-n/tst.profileusec.d
> +++ b/test/unittest/profile-n/tst.profileusec.d
> @@ -4,7 +4,6 @@
>    * Licensed under the Universal Permissive License v 1.0 as shown at
>    * http://oss.oracle.com/licenses/upl.
>    */
> -/* @@xfail: dtv2 */
>   
>   /*
>    * ASSERTION:
> @@ -20,6 +19,5 @@
>   
>   profile-200usec
>   {
> -	printf("This test is a simple profile-usec provider test");
>   	exit(0);
>   }
> diff --git a/test/unittest/profile-n/tst.profileusec.r b/test/unittest/profile-n/tst.profileusec.r
> deleted file mode 100644
> index 96dfef1c..00000000
> --- a/test/unittest/profile-n/tst.profileusec.r
> +++ /dev/null
> @@ -1 +0,0 @@
> -This test is a simple profile-usec provider test




More information about the DTrace-devel mailing list