blob: 60f8df1710fc806b9071b3e71041919ff7b9231c [file] [log] [blame]
#include "flash-ipmi.hpp"
#include <cstdio>
#include <gtest/gtest.h>
#include <string>
#define THIRTYTWO_MIB 33554432
TEST(FlashIpmiHashStartTest, OutofSequenceFails)
{
// Verify that the image must be started first. (can change).
std::string name = std::tmpnam(nullptr);
std::string name2 = std::tmpnam(nullptr);
FlashUpdate updater(name, "", name2);
EXPECT_FALSE(updater.startHash(THIRTYTWO_MIB));
(void)std::remove(name.c_str());
(void)std::remove(name2.c_str());
}
TEST(FlashIpmiHashStartTest, VerifyHashFileCreated)
{
// Verify that it's happy.
std::string name = std::tmpnam(nullptr);
std::string name2 = std::tmpnam(nullptr);
FlashUpdate updater(name, "", name2);
EXPECT_TRUE(updater.start(THIRTYTWO_MIB));
EXPECT_TRUE(updater.startHash(THIRTYTWO_MIB));
(void)std::remove(name.c_str());
(void)std::remove(name2.c_str());
}