12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #include "precompiled.hpp"
25 #include "logging/logFileOutput.hpp"
26 #include "memory/resourceArea.hpp"
27 #include "runtime/os.hpp"
28 #include "unittest.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "utilities/ostream.hpp"
31
32 static const char* name = "testlog.pid%p.%t.log";
33
34 // Test parsing a bunch of valid file output options
35 TEST(LogFileOutput, parse_valid) {
36 const char* valid_options[] = {
37 "", "filecount=10", "filesize=512",
38 "filecount=11,filesize=256",
39 "filesize=256,filecount=11",
40 "filesize=0", "filecount=1",
41 "filesize=1m", "filesize=1M",
42 "filesize=1k", "filesize=1G"
43 };
44
45 // Override LogOutput's vm_start time to get predictable file name
46 LogFileOutput::set_file_name_parameters(0);
47 char expected_filename[1 * K];
48 int ret = jio_snprintf(expected_filename, sizeof(expected_filename),
49 "testlog.pid%d.1970-01-01_01-00-00.log",
50 os::current_process_id());
51 ASSERT_GT(ret, 0) << "Buffer too small";
52
|
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #include "precompiled.hpp"
25 #include "logging/logFileOutput.hpp"
26 #include "memory/resourceArea.hpp"
27 #include "runtime/os.hpp"
28 #include "unittest.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "utilities/ostream.hpp"
31
32 static const char* name = "file=testlog.pid%p.%t.log";
33
34 // Test parsing a bunch of valid file output options
35 TEST(LogFileOutput, parse_valid) {
36 const char* valid_options[] = {
37 "", "filecount=10", "filesize=512",
38 "filecount=11,filesize=256",
39 "filesize=256,filecount=11",
40 "filesize=0", "filecount=1",
41 "filesize=1m", "filesize=1M",
42 "filesize=1k", "filesize=1G"
43 };
44
45 // Override LogOutput's vm_start time to get predictable file name
46 LogFileOutput::set_file_name_parameters(0);
47 char expected_filename[1 * K];
48 int ret = jio_snprintf(expected_filename, sizeof(expected_filename),
49 "testlog.pid%d.1970-01-01_01-00-00.log",
50 os::current_process_id());
51 ASSERT_GT(ret, 0) << "Buffer too small";
52
|