1e0c4386eSCy Schubert#! /usr/bin/env perl 2*a7148ab3SEnji Cooper# Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved. 3e0c4386eSCy Schubert# 4e0c4386eSCy Schubert# Licensed under the Apache License 2.0 (the "License"). You may not use 5e0c4386eSCy Schubert# this file except in compliance with the License. You can obtain a copy 6e0c4386eSCy Schubert# in the file LICENSE in the source distribution or at 7e0c4386eSCy Schubert# https://www.openssl.org/source/license.html 8e0c4386eSCy Schubert 9e0c4386eSCy Schubertuse strict; 10e0c4386eSCy Schubertuse warnings; 11e0c4386eSCy Schubert 12e0c4386eSCy Schubertuse OpenSSL::Test qw(:DEFAULT data_file); 13e0c4386eSCy Schubertuse OpenSSL::Test::Utils; 14e0c4386eSCy Schubertuse File::Compare qw(compare_text); 15e0c4386eSCy Schubert 16e0c4386eSCy Schubertsetup('test_conf'); 17e0c4386eSCy Schubert 18e0c4386eSCy Schubertmy %input_result = ( 19e0c4386eSCy Schubert 'dollarid_on.cnf' => 'dollarid_on.txt', 20e0c4386eSCy Schubert 'dollarid_off.cnf' => 'dollarid_off.txt', 21*a7148ab3SEnji Cooper 'oversized_line.cnf' => 'oversized_line.txt', 22e0c4386eSCy Schubert); 23e0c4386eSCy Schubert 24e0c4386eSCy Schubertplan skip_all => 'This is unsupported for cross compiled configurations' 25e0c4386eSCy Schubert if config('CROSS_COMPILE'); 26e0c4386eSCy Schubert 27e0c4386eSCy Schubertplan tests => 2 * scalar(keys %input_result); 28e0c4386eSCy Schubert 29e0c4386eSCy Schubertforeach (sort keys %input_result) { 30e0c4386eSCy Schubert SKIP: { 31e0c4386eSCy Schubert my $input_path = data_file($_); 32e0c4386eSCy Schubert my $expected_path = data_file($input_result{$_}); 33e0c4386eSCy Schubert my $result_path = "test_conf-$_-stdout"; 34e0c4386eSCy Schubert 35e0c4386eSCy Schubert skip "Problem dumping $_", 1 36e0c4386eSCy Schubert unless ok(run(test([ 'confdump', $input_path ], 37e0c4386eSCy Schubert stdout => $result_path)), 38e0c4386eSCy Schubert "dumping $_"); 39e0c4386eSCy Schubert is(compare_text($result_path, $expected_path, sub { 40e0c4386eSCy Schubert my $in1 = $_[0]; 41e0c4386eSCy Schubert my $in2 = $_[1]; 42e0c4386eSCy Schubert $in1 =~ s/\r\n/\n/g; 43e0c4386eSCy Schubert $in2 =~ s/\r\n/\n/g; 44e0c4386eSCy Schubert $in1 ne $in2}), 0, 45e0c4386eSCy Schubert "comparing the dump of $_ with $input_result{$_}"); 46e0c4386eSCy Schubert } 47e0c4386eSCy Schubert} 48