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