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